summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8087b55)
raw | patch | inline | side by side (parent: 8087b55)
author | Andy Wingo <wingo@pobox.com> | |
Mon, 18 Mar 2002 04:41:37 +0000 (04:41 +0000) | ||
committer | Andy Wingo <wingo@pobox.com> | |
Mon, 18 Mar 2002 04:41:37 +0000 (04:41 +0000) |
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
* 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
19 files changed:
index ecc59c9b3fea823b0012e8374ca603aee83b2d16..af3e374f3cb0aaaccc818d1594f51c24bc2944d0 100644 (file)
--- a/gst/autoplug/gstspider.c
+++ b/gst/autoplug/gstspider.c
/* generic templates */
GST_PADTEMPLATE_FACTORY (spider_src_factory,
- "src_%02d",
+ "src_%d",
GST_PAD_SRC,
GST_PAD_REQUEST,
NULL /* no caps */
);
GST_PADTEMPLATE_FACTORY (spider_sink_factory,
- "sink_%02d",
+ "sink_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
NULL /* no caps */
index badfd164d22796ffed67edf55c3dbd04ee76c0be..93efdf3d44483dcb85d5be7891e43da265c2f053 100644 (file)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- gst_element_install_std_props (
+ gst_element_class_install_std_props (
GST_ELEMENT_CLASS (klass),
"location", ARG_LOCATION, G_PARAM_READWRITE,
NULL);
index 5508099a4c01bee1edb78abbfc43c9e11d7d2005..c6d019812d503ba1e2fd052c8ae6798775d7b257 100644 (file)
NULL, G_PARAM_READABLE));
- gst_element_install_std_props (
+ gst_element_class_install_std_props (
GST_ELEMENT_CLASS (klass),
"silent", ARG_SILENT, G_PARAM_READWRITE,
"dump", ARG_DUMP, G_PARAM_READWRITE,
index e4d496e6ef27c2b501d6e1321f864e6326967541..18ef726cdcefadc739886f48345cfdd247d99efb 100644 (file)
g_param_spec_string ("last_message", "last_message", "last_message",
NULL, G_PARAM_READABLE));
- gst_element_install_std_props (
+ gst_element_class_install_std_props (
GST_ELEMENT_CLASS (klass),
"silent", ARG_SILENT, G_PARAM_READWRITE,
"dump", ARG_DUMP, G_PARAM_READWRITE,
index 8df24dbae3859e929c48c57f954f10a32ae21edb..3b6e9d8fa620a7ddc33fd45075ae162b855add38 100644 (file)
--- a/gst/elements/gstfdsink.c
+++ b/gst/elements/gstfdsink.c
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- gst_element_install_std_props (
+ gst_element_class_install_std_props (
GST_ELEMENT_CLASS (klass),
"fd", ARG_FD, G_PARAM_READWRITE,
NULL);
index acb738eb86e1fd719b9b2953f23ce7be0c49812f..54cf98551de10ce3c897ba9ee55c250dffb618a3 100644 (file)
--- a/gst/elements/gstfdsrc.c
+++ b/gst/elements/gstfdsrc.c
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
- gst_element_install_std_props (
+ gst_element_class_install_std_props (
GST_ELEMENT_CLASS (klass),
"location", ARG_LOCATION, G_PARAM_WRITABLE,
"bytesperread", ARG_BYTESPERREAD, G_PARAM_READWRITE,
index 409b38dde59fd08671f412f122616386c5754f02..2995e1023de9efb80d28419fd83ae0c951cb7909 100644 (file)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- gst_element_install_std_props (
+ gst_element_class_install_std_props (
GST_ELEMENT_CLASS (klass),
"fd", ARG_FD, G_PARAM_READABLE,
"offset", ARG_OFFSET, G_PARAM_READWRITE,
diff --git a/gst/gstbin.c b/gst/gstbin.c
index 840f3c803d2adcd2c9a3841492411cd052e6cd97..9e426b4554e06b264a7a598c48526993d11320f4 100644 (file)
--- a/gst/gstbin.c
+++ b/gst/gstbin.c
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));
if (oclass->iterate)
diff --git a/gst/gstbin.h b/gst/gstbin.h
index e922403495747e25684792a2b59cb284a8d935d5..016ddec36eb27b016246c71340140eeb09a9e485 100644 (file)
--- a/gst/gstbin.h
+++ b/gst/gstbin.h
GST_BIN_FLAG_FIXED_CLOCK,
+ /* bin iterates itself, like a bin with a jack element in it */
+ GST_BIN_SELF_ITERATING,
+
/* padding */
- GST_BIN_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 4,
+ GST_BIN_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 5,
} GstBinFlags;
/*typedef struct _GstBin GstBin; */
diff --git a/gst/gstelement.c b/gst/gstelement.c
index 47404948a409eaff6bf2216742367121205e9ec1..cc25b552685b192df715665526143d8ca5e27852 100644 (file)
--- a/gst/gstelement.c
+++ b/gst/gstelement.c
gboolean templ_found = FALSE;
GList *list;
gint n;
+ gchar *str;
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);
- if (strstr (name, "%d")) {
- templ = gst_element_get_padtemplate_by_name (element, name);
- templ_found = (templ != NULL);
- req_name = NULL;
+ if (strstr (name, "%")) {
+ templ = gst_element_get_padtemplate_by_name (element, name);
+ req_name = NULL;
+ if (templ)
+ templ_found = TRUE;
} 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 = gst_element_get_padtemplate_list(element);
+ while (!templ_found && list) {
+ templ = (GstPadTemplate*) list->data;
+ if (templ->presence == GST_PAD_REQUEST) {
+ /* we know that %s and %d are the ony possibilities because of sanity
+ checks in gst_padtemplate_new */
+ if (strstr (templ->name_template, "%d")) {
+ if (sscanf(name, templ->name_template, &n)) {
+ templ_found = TRUE;
+ req_name = name;
+ break;
+ }
+ } else if (strstr (templ->name_template, "%s")) {
+ if (sscanf(name, templ->name_template, &str)) {
+ templ_found = TRUE;
+ req_name = name;
+ break;
}
- list = list->next;
+ }
}
+ list = list->next;
+ }
}
if (!templ_found)
}
/**
- * gst_element_install_std_props:
+ * gst_element_class_install_std_props:
* @klass: the class to add the properties to
* @first_name: the first in a NULL terminated
* 'name', 'id', 'flags' triplet list.
* the flags determine readability / writeability.
**/
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;
@@ -1910,6 +1922,14 @@ gst_element_install_std_props (GstElementClass * klass, const char *first_name,
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*
gst_element_get_managing_bin (GstElement *element)
{
diff --git a/gst/gstelement.h b/gst/gstelement.h
index 2cb26d544590cc404a978092a8e7cfb97f8f4169..7440cba4b598a6bc15582a3b1050ad46a00eed2d 100644 (file)
--- a/gst/gstelement.h
+++ b/gst/gstelement.h
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, ...);
GstBin* gst_element_get_managing_bin (GstElement *element);
diff --git a/gst/gstpad.c b/gst/gstpad.c
index fbf2d8a796458955b48c5854b414624d5f4cbc80..9ac7a1b91d855e97b27ef7bb7b63ba2bd524c3e7 100644 (file)
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
{
}
+/* 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:
* @name_template: the name template
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);
GST_PADTEMPLATE_NAME_TEMPLATE (new) = name_template;
index badfd164d22796ffed67edf55c3dbd04ee76c0be..93efdf3d44483dcb85d5be7891e43da265c2f053 100644 (file)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- gst_element_install_std_props (
+ gst_element_class_install_std_props (
GST_ELEMENT_CLASS (klass),
"location", ARG_LOCATION, G_PARAM_READWRITE,
NULL);
index 5508099a4c01bee1edb78abbfc43c9e11d7d2005..c6d019812d503ba1e2fd052c8ae6798775d7b257 100644 (file)
NULL, G_PARAM_READABLE));
- gst_element_install_std_props (
+ gst_element_class_install_std_props (
GST_ELEMENT_CLASS (klass),
"silent", ARG_SILENT, G_PARAM_READWRITE,
"dump", ARG_DUMP, G_PARAM_READWRITE,
index e4d496e6ef27c2b501d6e1321f864e6326967541..18ef726cdcefadc739886f48345cfdd247d99efb 100644 (file)
g_param_spec_string ("last_message", "last_message", "last_message",
NULL, G_PARAM_READABLE));
- gst_element_install_std_props (
+ gst_element_class_install_std_props (
GST_ELEMENT_CLASS (klass),
"silent", ARG_SILENT, G_PARAM_READWRITE,
"dump", ARG_DUMP, G_PARAM_READWRITE,
index 8df24dbae3859e929c48c57f954f10a32ae21edb..3b6e9d8fa620a7ddc33fd45075ae162b855add38 100644 (file)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- gst_element_install_std_props (
+ gst_element_class_install_std_props (
GST_ELEMENT_CLASS (klass),
"fd", ARG_FD, G_PARAM_READWRITE,
NULL);
index acb738eb86e1fd719b9b2953f23ce7be0c49812f..54cf98551de10ce3c897ba9ee55c250dffb618a3 100644 (file)
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
- gst_element_install_std_props (
+ gst_element_class_install_std_props (
GST_ELEMENT_CLASS (klass),
"location", ARG_LOCATION, G_PARAM_WRITABLE,
"bytesperread", ARG_BYTESPERREAD, G_PARAM_READWRITE,
index 409b38dde59fd08671f412f122616386c5754f02..2995e1023de9efb80d28419fd83ae0c951cb7909 100644 (file)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- gst_element_install_std_props (
+ gst_element_class_install_std_props (
GST_ELEMENT_CLASS (klass),
"fd", ARG_FD, G_PARAM_READABLE,
"offset", ARG_OFFSET, G_PARAM_READWRITE,
diff --git a/tools/gst-launch.c b/tools/gst-launch.c
index 792cfefdf2369807896e264b381b5899b6c774c8..a17ac8fe25beef35a44b4a0e0835a2fbcd688000 100644 (file)
--- a/tools/gst-launch.c
+++ b/tools/gst-launch.c
exit (-1);
}
- g_idle_add (idle_func, pipeline);
- gst_main ();
+ if (!GST_FLAG_IS_SET (GST_OBJECT (pipeline), GST_BIN_SELF_ITERATING)) {
+ 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_buffer_print_stats();