mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-20 22:28:22 +00:00
- if you call gst_element_request_pad_by_name() with, say "sink4" as the pad name and there is a "sink%d" template, t...
Original commit message from CVS: - if you call gst_element_request_pad_by_name() with, say "sink4" as the pad name and there is a "sink%d" template, the request_new_pad function will be called. this is to allow for, for example, requesting a certain channel on a multichannel device. - to this end, request_new_pad now has the following prototype: GstPad* (*request_new_pad) (GstElement *element, GstPadTemplate *templ, const gchar *name) if request_pad_by_name was called with a name like "sink%d" (i.e. no parsing was necessary) then NULL is passed as 'name'. - all plugins that use request pads have been changed to the new api. also, some incremental (untested) alsa updates, switching to the bytestream api...
This commit is contained in:
parent
3056a25c58
commit
a7fa31afef
8 changed files with 47 additions and 22 deletions
|
@ -76,7 +76,8 @@ gst_aggregator_sched_get_type (void)
|
|||
static void gst_aggregator_class_init (GstAggregatorClass *klass);
|
||||
static void gst_aggregator_init (GstAggregator *aggregator);
|
||||
|
||||
static GstPad* gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *temp);
|
||||
static GstPad* gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *temp, const
|
||||
gchar *unused);
|
||||
|
||||
static void gst_aggregator_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
|
@ -150,7 +151,7 @@ gst_aggregator_init (GstAggregator *aggregator)
|
|||
}
|
||||
|
||||
static GstPad*
|
||||
gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *templ)
|
||||
gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar *unused)
|
||||
{
|
||||
gchar *name;
|
||||
GstPad *sinkpad;
|
||||
|
|
|
@ -58,7 +58,8 @@ GST_PADTEMPLATE_FACTORY (fakesink_sink_factory,
|
|||
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 GstPad* gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ, const
|
||||
gchar *unused);
|
||||
|
||||
static void gst_fakesink_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
|
@ -137,7 +138,7 @@ gst_fakesink_init (GstFakeSink *fakesink)
|
|||
}
|
||||
|
||||
static GstPad*
|
||||
gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ)
|
||||
gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar *unused)
|
||||
{
|
||||
gchar *name;
|
||||
GstPad *sinkpad;
|
||||
|
|
|
@ -56,7 +56,7 @@ GST_PADTEMPLATE_FACTORY (tee_src_factory,
|
|||
static void gst_tee_class_init (GstTeeClass *klass);
|
||||
static void gst_tee_init (GstTee *tee);
|
||||
|
||||
static GstPad* gst_tee_request_new_pad (GstElement *element, GstPadTemplate *temp);
|
||||
static GstPad* gst_tee_request_new_pad (GstElement *element, GstPadTemplate *temp, const gchar *unused);
|
||||
|
||||
static void gst_tee_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
|
@ -127,7 +127,7 @@ gst_tee_init (GstTee *tee)
|
|||
}
|
||||
|
||||
static GstPad*
|
||||
gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ)
|
||||
gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar *unused)
|
||||
{
|
||||
gchar *name;
|
||||
GstPad *srcpad;
|
||||
|
|
|
@ -604,14 +604,14 @@ gst_element_get_padtemplate_by_compatible (GstElement *element, GstPadTemplate *
|
|||
}
|
||||
|
||||
static GstPad*
|
||||
gst_element_request_pad (GstElement *element, GstPadTemplate *templ)
|
||||
gst_element_request_pad (GstElement *element, GstPadTemplate *templ, const gchar* name)
|
||||
{
|
||||
GstPad *newpad = NULL;
|
||||
GstElementClass *oclass;
|
||||
|
||||
oclass = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS(element));
|
||||
if (oclass->request_new_pad)
|
||||
newpad = (oclass->request_new_pad)(element, templ);
|
||||
newpad = (oclass->request_new_pad)(element, templ, name);
|
||||
|
||||
return newpad;
|
||||
}
|
||||
|
@ -640,7 +640,7 @@ gst_element_request_compatible_pad (GstElement *element, GstPadTemplate *templ)
|
|||
|
||||
templ_new = gst_element_get_padtemplate_by_compatible (element, templ);
|
||||
if (templ_new != NULL)
|
||||
pad = gst_element_request_pad (element, templ_new);
|
||||
pad = gst_element_request_pad (element, templ_new, NULL);
|
||||
|
||||
return pad;
|
||||
}
|
||||
|
@ -660,19 +660,40 @@ gst_element_request_compatible_pad (GstElement *element, GstPadTemplate *templ)
|
|||
GstPad*
|
||||
gst_element_request_pad_by_name (GstElement *element, const gchar *name)
|
||||
{
|
||||
GstPadTemplate *templ;
|
||||
GstPadTemplate *templ = NULL;
|
||||
GstPad *pad;
|
||||
const gchar *req_name = NULL;
|
||||
gboolean templ_found = FALSE;
|
||||
GList *list;
|
||||
gint n;
|
||||
|
||||
g_return_val_if_fail (element != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
templ = gst_element_get_padtemplate_by_name (element, name);
|
||||
if (strstr (name, "%d")) {
|
||||
templ = gst_element_get_padtemplate_by_name (element, name);
|
||||
req_name = NULL;
|
||||
} else {
|
||||
list = gst_element_get_padtemplate_list(element);
|
||||
while (!templ_found && list) {
|
||||
templ = (GstPadTemplate*) list->data;
|
||||
if (strstr (templ->name_template, "%d")) {
|
||||
if (sscanf(name, templ->name_template, &n)) {
|
||||
templ_found = TRUE;
|
||||
req_name = name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (templ == NULL)
|
||||
return NULL;
|
||||
|
||||
pad = gst_element_request_pad (element, templ);
|
||||
|
||||
return NULL;
|
||||
|
||||
pad = gst_element_request_pad (element, templ, req_name);
|
||||
|
||||
return pad;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ struct _GstElementClass {
|
|||
/* change the element state */
|
||||
GstElementStateReturn (*change_state) (GstElement *element);
|
||||
/* request a new pad */
|
||||
GstPad* (*request_new_pad) (GstElement *element, GstPadTemplate *templ);
|
||||
GstPad* (*request_new_pad) (GstElement *element, GstPadTemplate *templ, const gchar* name);
|
||||
};
|
||||
|
||||
void gst_element_class_add_padtemplate (GstElementClass *element, GstPadTemplate *templ);
|
||||
|
|
|
@ -76,7 +76,8 @@ gst_aggregator_sched_get_type (void)
|
|||
static void gst_aggregator_class_init (GstAggregatorClass *klass);
|
||||
static void gst_aggregator_init (GstAggregator *aggregator);
|
||||
|
||||
static GstPad* gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *temp);
|
||||
static GstPad* gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *temp, const
|
||||
gchar *unused);
|
||||
|
||||
static void gst_aggregator_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
|
@ -150,7 +151,7 @@ gst_aggregator_init (GstAggregator *aggregator)
|
|||
}
|
||||
|
||||
static GstPad*
|
||||
gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *templ)
|
||||
gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar *unused)
|
||||
{
|
||||
gchar *name;
|
||||
GstPad *sinkpad;
|
||||
|
|
|
@ -58,7 +58,8 @@ GST_PADTEMPLATE_FACTORY (fakesink_sink_factory,
|
|||
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 GstPad* gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ, const
|
||||
gchar *unused);
|
||||
|
||||
static void gst_fakesink_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
|
@ -137,7 +138,7 @@ gst_fakesink_init (GstFakeSink *fakesink)
|
|||
}
|
||||
|
||||
static GstPad*
|
||||
gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ)
|
||||
gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar *unused)
|
||||
{
|
||||
gchar *name;
|
||||
GstPad *sinkpad;
|
||||
|
|
|
@ -56,7 +56,7 @@ GST_PADTEMPLATE_FACTORY (tee_src_factory,
|
|||
static void gst_tee_class_init (GstTeeClass *klass);
|
||||
static void gst_tee_init (GstTee *tee);
|
||||
|
||||
static GstPad* gst_tee_request_new_pad (GstElement *element, GstPadTemplate *temp);
|
||||
static GstPad* gst_tee_request_new_pad (GstElement *element, GstPadTemplate *temp, const gchar *unused);
|
||||
|
||||
static void gst_tee_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
|
@ -127,7 +127,7 @@ gst_tee_init (GstTee *tee)
|
|||
}
|
||||
|
||||
static GstPad*
|
||||
gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ)
|
||||
gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar *unused)
|
||||
{
|
||||
gchar *name;
|
||||
GstPad *srcpad;
|
||||
|
|
Loading…
Reference in a new issue