mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
s/gst_element_install_std_props/gst_element_class_install_std_props/ -- it just makes more sense that way added jack ...
Original commit message from CVS: * s/gst_element_install_std_props/gst_element_class_install_std_props/ -- it just makes more sense that way * added jack element, doesn't quite work right yet but i didn't want to lose the work -- it does build, register, and attempt to run though * imposed some restrictions on the naming of request pads to better allow for reverse parsing * added '%s' to reverse parsing * added new bin flag to indicate that it is self-iterating, and some lame code in gst-launch to test it out * fixen on launch-gui * added pkg-config stuff for the editor's libs
This commit is contained in:
parent
8087b55e47
commit
a43fadec2e
19 changed files with 103 additions and 34 deletions
|
@ -59,14 +59,14 @@ enum {
|
||||||
|
|
||||||
/* generic templates */
|
/* generic templates */
|
||||||
GST_PADTEMPLATE_FACTORY (spider_src_factory,
|
GST_PADTEMPLATE_FACTORY (spider_src_factory,
|
||||||
"src_%02d",
|
"src_%d",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_REQUEST,
|
GST_PAD_REQUEST,
|
||||||
NULL /* no caps */
|
NULL /* no caps */
|
||||||
);
|
);
|
||||||
|
|
||||||
GST_PADTEMPLATE_FACTORY (spider_sink_factory,
|
GST_PADTEMPLATE_FACTORY (spider_sink_factory,
|
||||||
"sink_%02d",
|
"sink_%d",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_REQUEST,
|
GST_PAD_REQUEST,
|
||||||
NULL /* no caps */
|
NULL /* no caps */
|
||||||
|
|
|
@ -101,7 +101,7 @@ gst_disksink_class_init (GstDiskSinkClass *klass)
|
||||||
|
|
||||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
gst_element_install_std_props (
|
gst_element_class_install_std_props (
|
||||||
GST_ELEMENT_CLASS (klass),
|
GST_ELEMENT_CLASS (klass),
|
||||||
"location", ARG_LOCATION, G_PARAM_READWRITE,
|
"location", ARG_LOCATION, G_PARAM_READWRITE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -113,7 +113,7 @@ gst_fakesink_class_init (GstFakeSinkClass *klass)
|
||||||
NULL, G_PARAM_READABLE));
|
NULL, G_PARAM_READABLE));
|
||||||
|
|
||||||
|
|
||||||
gst_element_install_std_props (
|
gst_element_class_install_std_props (
|
||||||
GST_ELEMENT_CLASS (klass),
|
GST_ELEMENT_CLASS (klass),
|
||||||
"silent", ARG_SILENT, G_PARAM_READWRITE,
|
"silent", ARG_SILENT, G_PARAM_READWRITE,
|
||||||
"dump", ARG_DUMP, G_PARAM_READWRITE,
|
"dump", ARG_DUMP, G_PARAM_READWRITE,
|
||||||
|
|
|
@ -236,7 +236,7 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
|
||||||
g_param_spec_string ("last_message", "last_message", "last_message",
|
g_param_spec_string ("last_message", "last_message", "last_message",
|
||||||
NULL, G_PARAM_READABLE));
|
NULL, G_PARAM_READABLE));
|
||||||
|
|
||||||
gst_element_install_std_props (
|
gst_element_class_install_std_props (
|
||||||
GST_ELEMENT_CLASS (klass),
|
GST_ELEMENT_CLASS (klass),
|
||||||
"silent", ARG_SILENT, G_PARAM_READWRITE,
|
"silent", ARG_SILENT, G_PARAM_READWRITE,
|
||||||
"dump", ARG_DUMP, G_PARAM_READWRITE,
|
"dump", ARG_DUMP, G_PARAM_READWRITE,
|
||||||
|
|
|
@ -89,7 +89,7 @@ gst_fdsink_class_init (GstFdSinkClass *klass)
|
||||||
|
|
||||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
gst_element_install_std_props (
|
gst_element_class_install_std_props (
|
||||||
GST_ELEMENT_CLASS (klass),
|
GST_ELEMENT_CLASS (klass),
|
||||||
"fd", ARG_FD, G_PARAM_READWRITE,
|
"fd", ARG_FD, G_PARAM_READWRITE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -98,7 +98,7 @@ gst_fdsrc_class_init (GstFdSrcClass *klass)
|
||||||
|
|
||||||
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
|
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
gst_element_install_std_props (
|
gst_element_class_install_std_props (
|
||||||
GST_ELEMENT_CLASS (klass),
|
GST_ELEMENT_CLASS (klass),
|
||||||
"location", ARG_LOCATION, G_PARAM_WRITABLE,
|
"location", ARG_LOCATION, G_PARAM_WRITABLE,
|
||||||
"bytesperread", ARG_BYTESPERREAD, G_PARAM_READWRITE,
|
"bytesperread", ARG_BYTESPERREAD, G_PARAM_READWRITE,
|
||||||
|
|
|
@ -149,7 +149,7 @@ gst_filesrc_class_init (GstFileSrcClass *klass)
|
||||||
|
|
||||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
gst_element_install_std_props (
|
gst_element_class_install_std_props (
|
||||||
GST_ELEMENT_CLASS (klass),
|
GST_ELEMENT_CLASS (klass),
|
||||||
"fd", ARG_FD, G_PARAM_READABLE,
|
"fd", ARG_FD, G_PARAM_READABLE,
|
||||||
"offset", ARG_OFFSET, G_PARAM_READWRITE,
|
"offset", ARG_OFFSET, G_PARAM_READWRITE,
|
||||||
|
|
|
@ -890,6 +890,9 @@ gst_bin_iterate (GstBin * bin)
|
||||||
|
|
||||||
GST_DEBUG_ENTER ("(\"%s\")", GST_ELEMENT_NAME (bin));
|
GST_DEBUG_ENTER ("(\"%s\")", GST_ELEMENT_NAME (bin));
|
||||||
|
|
||||||
|
g_return_val_if_fail (bin != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GST_IS_BIN (bin), FALSE);
|
||||||
|
|
||||||
oclass = GST_BIN_CLASS (G_OBJECT_GET_CLASS (bin));
|
oclass = GST_BIN_CLASS (G_OBJECT_GET_CLASS (bin));
|
||||||
|
|
||||||
if (oclass->iterate)
|
if (oclass->iterate)
|
||||||
|
|
|
@ -63,8 +63,11 @@ typedef enum {
|
||||||
|
|
||||||
GST_BIN_FLAG_FIXED_CLOCK,
|
GST_BIN_FLAG_FIXED_CLOCK,
|
||||||
|
|
||||||
|
/* bin iterates itself, like a bin with a jack element in it */
|
||||||
|
GST_BIN_SELF_ITERATING,
|
||||||
|
|
||||||
/* padding */
|
/* padding */
|
||||||
GST_BIN_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 4,
|
GST_BIN_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 5,
|
||||||
} GstBinFlags;
|
} GstBinFlags;
|
||||||
|
|
||||||
/*typedef struct _GstBin GstBin; */
|
/*typedef struct _GstBin GstBin; */
|
||||||
|
|
|
@ -712,28 +712,40 @@ gst_element_request_pad_by_name (GstElement *element, const gchar *name)
|
||||||
gboolean templ_found = FALSE;
|
gboolean templ_found = FALSE;
|
||||||
GList *list;
|
GList *list;
|
||||||
gint n;
|
gint n;
|
||||||
|
gchar *str;
|
||||||
|
|
||||||
g_return_val_if_fail (element != NULL, NULL);
|
g_return_val_if_fail (element != NULL, NULL);
|
||||||
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
||||||
g_return_val_if_fail (name != NULL, NULL);
|
g_return_val_if_fail (name != NULL, NULL);
|
||||||
|
|
||||||
if (strstr (name, "%d")) {
|
if (strstr (name, "%")) {
|
||||||
templ = gst_element_get_padtemplate_by_name (element, name);
|
templ = gst_element_get_padtemplate_by_name (element, name);
|
||||||
templ_found = (templ != NULL);
|
req_name = NULL;
|
||||||
req_name = NULL;
|
if (templ)
|
||||||
|
templ_found = TRUE;
|
||||||
} else {
|
} else {
|
||||||
list = gst_element_get_padtemplate_list(element);
|
list = gst_element_get_padtemplate_list(element);
|
||||||
while (!templ_found && list) {
|
while (!templ_found && list) {
|
||||||
templ = (GstPadTemplate*) list->data;
|
templ = (GstPadTemplate*) list->data;
|
||||||
if (strstr (templ->name_template, "%d")) {
|
if (templ->presence == GST_PAD_REQUEST) {
|
||||||
if (sscanf(name, templ->name_template, &n)) {
|
/* we know that %s and %d are the ony possibilities because of sanity
|
||||||
templ_found = TRUE;
|
checks in gst_padtemplate_new */
|
||||||
req_name = name;
|
if (strstr (templ->name_template, "%d")) {
|
||||||
break;
|
if (sscanf(name, templ->name_template, &n)) {
|
||||||
}
|
templ_found = TRUE;
|
||||||
|
req_name = name;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
list = list->next;
|
} else if (strstr (templ->name_template, "%s")) {
|
||||||
|
if (sscanf(name, templ->name_template, &str)) {
|
||||||
|
templ_found = TRUE;
|
||||||
|
req_name = name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
list = list->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!templ_found)
|
if (!templ_found)
|
||||||
|
@ -1875,7 +1887,7 @@ gst_element_populate_std_props (GObjectClass * klass,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_element_install_std_props:
|
* gst_element_class_install_std_props:
|
||||||
* @klass: the class to add the properties to
|
* @klass: the class to add the properties to
|
||||||
* @first_name: the first in a NULL terminated
|
* @first_name: the first in a NULL terminated
|
||||||
* 'name', 'id', 'flags' triplet list.
|
* 'name', 'id', 'flags' triplet list.
|
||||||
|
@ -1886,7 +1898,7 @@ gst_element_populate_std_props (GObjectClass * klass,
|
||||||
* the flags determine readability / writeability.
|
* the flags determine readability / writeability.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gst_element_install_std_props (GstElementClass * klass, const char *first_name, ...)
|
gst_element_class_install_std_props (GstElementClass * klass, const char *first_name, ...)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
|
@ -1910,6 +1922,14 @@ gst_element_install_std_props (GstElementClass * klass, const char *first_name,
|
||||||
va_end (args);
|
va_end (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_element_get_managing_bin:
|
||||||
|
* @element: the element in question
|
||||||
|
*
|
||||||
|
* Get the managing bin (a pipeline or a thread, for example) of an element.
|
||||||
|
*
|
||||||
|
* Returns: the bin, or NULL on failure
|
||||||
|
**/
|
||||||
GstBin*
|
GstBin*
|
||||||
gst_element_get_managing_bin (GstElement *element)
|
gst_element_get_managing_bin (GstElement *element)
|
||||||
{
|
{
|
||||||
|
|
|
@ -243,7 +243,7 @@ void gst_element_error (GstElement *element, const gchar *error, ...);
|
||||||
|
|
||||||
GstElementFactory* gst_element_get_factory (GstElement *element);
|
GstElementFactory* gst_element_get_factory (GstElement *element);
|
||||||
|
|
||||||
void gst_element_install_std_props (GstElementClass *klass,
|
void gst_element_class_install_std_props (GstElementClass *klass,
|
||||||
const char *first_name, ...);
|
const char *first_name, ...);
|
||||||
|
|
||||||
GstBin* gst_element_get_managing_bin (GstElement *element);
|
GstBin* gst_element_get_managing_bin (GstElement *element);
|
||||||
|
|
38
gst/gstpad.c
38
gst/gstpad.c
|
@ -2009,6 +2009,41 @@ gst_padtemplate_init (GstPadTemplate *templ)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ALWAYS padtemplates cannot have conversion specifications, it doesn't make
|
||||||
|
* sense.
|
||||||
|
* SOMETIMES padtemplates can do whatever they want, they are provided by the
|
||||||
|
* element.
|
||||||
|
* REQUEST padtemplates can be reverse-parsed (the user asks for 'sink1', the
|
||||||
|
* 'sink%d' template is automatically selected), so we need to restrict their
|
||||||
|
* naming.
|
||||||
|
*/
|
||||||
|
static gboolean
|
||||||
|
name_is_valid (const gchar *name, GstPadPresence presence)
|
||||||
|
{
|
||||||
|
const gchar *str;
|
||||||
|
|
||||||
|
if (presence == GST_PAD_ALWAYS) {
|
||||||
|
if (strchr (name, '%')) {
|
||||||
|
g_warning ("invalid name template %s: conversion specifications are not"
|
||||||
|
" allowed for GST_PAD_ALWAYS padtemplates", name);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
} else if (presence == GST_PAD_REQUEST) {
|
||||||
|
if ((str = strchr (name, '%')) && strchr (str + 1, '%')) {
|
||||||
|
g_warning ("invalid name template %s: only one conversion specification"
|
||||||
|
" allowed in GST_PAD_REQUEST padtemplate", name);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (str && (*(str+1) != 's' && *(str+1) != 'd')) {
|
||||||
|
g_warning ("invalid name template %s: conversion specification must be of"
|
||||||
|
" type '%%d' or '%%s' for GST_PAD_REQUEST padtemplate", name);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_padtemplate_new:
|
* gst_padtemplate_new:
|
||||||
* @name_template: the name template
|
* @name_template: the name template
|
||||||
|
@ -2032,6 +2067,9 @@ gst_padtemplate_new (gchar *name_template,
|
||||||
|
|
||||||
g_return_val_if_fail (name_template != NULL, NULL);
|
g_return_val_if_fail (name_template != NULL, NULL);
|
||||||
|
|
||||||
|
if (!name_is_valid (name_template, presence))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
new = g_object_new(gst_padtemplate_get_type () ,NULL);
|
new = g_object_new(gst_padtemplate_get_type () ,NULL);
|
||||||
|
|
||||||
GST_PADTEMPLATE_NAME_TEMPLATE (new) = name_template;
|
GST_PADTEMPLATE_NAME_TEMPLATE (new) = name_template;
|
||||||
|
|
|
@ -101,7 +101,7 @@ gst_disksink_class_init (GstDiskSinkClass *klass)
|
||||||
|
|
||||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
gst_element_install_std_props (
|
gst_element_class_install_std_props (
|
||||||
GST_ELEMENT_CLASS (klass),
|
GST_ELEMENT_CLASS (klass),
|
||||||
"location", ARG_LOCATION, G_PARAM_READWRITE,
|
"location", ARG_LOCATION, G_PARAM_READWRITE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -113,7 +113,7 @@ gst_fakesink_class_init (GstFakeSinkClass *klass)
|
||||||
NULL, G_PARAM_READABLE));
|
NULL, G_PARAM_READABLE));
|
||||||
|
|
||||||
|
|
||||||
gst_element_install_std_props (
|
gst_element_class_install_std_props (
|
||||||
GST_ELEMENT_CLASS (klass),
|
GST_ELEMENT_CLASS (klass),
|
||||||
"silent", ARG_SILENT, G_PARAM_READWRITE,
|
"silent", ARG_SILENT, G_PARAM_READWRITE,
|
||||||
"dump", ARG_DUMP, G_PARAM_READWRITE,
|
"dump", ARG_DUMP, G_PARAM_READWRITE,
|
||||||
|
|
|
@ -236,7 +236,7 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
|
||||||
g_param_spec_string ("last_message", "last_message", "last_message",
|
g_param_spec_string ("last_message", "last_message", "last_message",
|
||||||
NULL, G_PARAM_READABLE));
|
NULL, G_PARAM_READABLE));
|
||||||
|
|
||||||
gst_element_install_std_props (
|
gst_element_class_install_std_props (
|
||||||
GST_ELEMENT_CLASS (klass),
|
GST_ELEMENT_CLASS (klass),
|
||||||
"silent", ARG_SILENT, G_PARAM_READWRITE,
|
"silent", ARG_SILENT, G_PARAM_READWRITE,
|
||||||
"dump", ARG_DUMP, G_PARAM_READWRITE,
|
"dump", ARG_DUMP, G_PARAM_READWRITE,
|
||||||
|
|
|
@ -89,7 +89,7 @@ gst_fdsink_class_init (GstFdSinkClass *klass)
|
||||||
|
|
||||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
gst_element_install_std_props (
|
gst_element_class_install_std_props (
|
||||||
GST_ELEMENT_CLASS (klass),
|
GST_ELEMENT_CLASS (klass),
|
||||||
"fd", ARG_FD, G_PARAM_READWRITE,
|
"fd", ARG_FD, G_PARAM_READWRITE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -98,7 +98,7 @@ gst_fdsrc_class_init (GstFdSrcClass *klass)
|
||||||
|
|
||||||
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
|
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
gst_element_install_std_props (
|
gst_element_class_install_std_props (
|
||||||
GST_ELEMENT_CLASS (klass),
|
GST_ELEMENT_CLASS (klass),
|
||||||
"location", ARG_LOCATION, G_PARAM_WRITABLE,
|
"location", ARG_LOCATION, G_PARAM_WRITABLE,
|
||||||
"bytesperread", ARG_BYTESPERREAD, G_PARAM_READWRITE,
|
"bytesperread", ARG_BYTESPERREAD, G_PARAM_READWRITE,
|
||||||
|
|
|
@ -149,7 +149,7 @@ gst_filesrc_class_init (GstFileSrcClass *klass)
|
||||||
|
|
||||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
gst_element_install_std_props (
|
gst_element_class_install_std_props (
|
||||||
GST_ELEMENT_CLASS (klass),
|
GST_ELEMENT_CLASS (klass),
|
||||||
"fd", ARG_FD, G_PARAM_READABLE,
|
"fd", ARG_FD, G_PARAM_READABLE,
|
||||||
"offset", ARG_OFFSET, G_PARAM_READWRITE,
|
"offset", ARG_OFFSET, G_PARAM_READWRITE,
|
||||||
|
|
|
@ -198,8 +198,13 @@ main(int argc, char *argv[])
|
||||||
exit (-1);
|
exit (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_idle_add (idle_func, pipeline);
|
if (!GST_FLAG_IS_SET (GST_OBJECT (pipeline), GST_BIN_SELF_ITERATING)) {
|
||||||
gst_main ();
|
g_idle_add (idle_func, pipeline);
|
||||||
|
gst_main ();
|
||||||
|
} else {
|
||||||
|
g_print ("sleeping 100...\n");
|
||||||
|
sleep (100);
|
||||||
|
}
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
gst_buffer_print_stats();
|
gst_buffer_print_stats();
|
||||||
|
|
Loading…
Reference in a new issue