From cfb228b0f92bf67be5d98a7eae6f4c0d60d7d404 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sat, 30 Mar 2002 19:31:14 +0000 Subject: [PATCH] add notify back to filesrc, it's needed for MVC applications remove notify printouts from gst-launch cleanup in gst-p... Original commit message from CVS: * add notify back to filesrc, it's needed for MVC applications * remove notify printouts from gst-launch * cleanup in gst-plugins configure.ac * some jack updates * remove SELF_ITERATING flag in favor of SEF_SCHEDULABLE (not a clear name, but it's what we have for the moment) * improve parsing of request pad names, no more sscanf * fixes to the fastscheduler Makefile.am --- gst/elements/gstfilesrc.c | 6 +++--- gst/gstbin.h | 6 ++---- gst/gstelement.c | 27 ++++++++++++++++----------- gst/gstpad.c | 5 +++++ gst/schedulers/Makefile.am | 4 ++-- plugins/elements/gstfilesrc.c | 6 +++--- tools/gst-launch.c | 19 +++++++------------ 7 files changed, 38 insertions(+), 35 deletions(-) diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index c50e8c5..da40902 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -549,7 +549,7 @@ gst_filesrc_get (GstPad *pad) /* we're done, return the buffer */ src->curoffset += GST_BUFFER_SIZE(buf); - //g_object_notify (G_OBJECT (src), "offset"); + g_object_notify (G_OBJECT (src), "offset"); return buf; } @@ -590,7 +590,7 @@ gst_filesrc_open_file (GstFileSrc *src) /* now notify of the changes */ g_object_freeze_notify (G_OBJECT (src)); g_object_notify (G_OBJECT (src), "filesize"); - //g_object_notify (G_OBJECT (src), "offset"); + g_object_notify (G_OBJECT (src), "offset"); g_object_thaw_notify (G_OBJECT (src)); GST_FLAG_SET (src, GST_FILESRC_OPEN); @@ -614,7 +614,7 @@ gst_filesrc_close_file (GstFileSrc *src) /* and notify that things changed */ g_object_freeze_notify (G_OBJECT (src)); g_object_notify (G_OBJECT (src), "filesize"); - //g_object_notify (G_OBJECT (src), "offset"); + g_object_notify (G_OBJECT (src), "offset"); g_object_thaw_notify (G_OBJECT (src)); if (src->mapbuf) diff --git a/gst/gstbin.h b/gst/gstbin.h index 4e433ea..fb33713 100644 --- a/gst/gstbin.h +++ b/gst/gstbin.h @@ -51,7 +51,8 @@ extern GType _gst_bin_type; typedef enum { /* this bin is a manager of child elements, i.e. a pipeline or thread */ GST_BIN_FLAG_MANAGER = GST_ELEMENT_FLAG_LAST, - /* this bin is actually a meta-bin, and may need to be scheduled */ + + /* this bin iterates itself */ GST_BIN_SELF_SCHEDULABLE, /* we prefer to have cothreads when its an option, over chain-based */ @@ -59,9 +60,6 @@ typedef enum { 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 + 5, } GstBinFlags; diff --git a/gst/gstelement.c b/gst/gstelement.c index 1116af1..a435132d 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -717,7 +717,7 @@ gst_element_request_pad_by_name (GstElement *element, const gchar *name) gboolean templ_found = FALSE; GList *list; gint n; - gchar *str; + gchar *str, *data, *endptr; g_return_val_if_fail (element != NULL, NULL); g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); @@ -734,16 +734,22 @@ gst_element_request_pad_by_name (GstElement *element, const gchar *name) 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 + /* we know that %s and %d are the only 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)) { + if ((str = strchr (templ->name_template, '%')) && + strncmp (templ->name_template, name, str - templ->name_template) == 0 && + strlen (name) > str - templ->name_template) { + data = name + (str - templ->name_template); + if (*(str+1) == 'd') { + /* it's an int */ + n = (gint) strtol (data, &endptr, 10); + if (endptr == NULL) { + templ_found = TRUE; + req_name = name; + break; + } + } else { + /* it's a string */ templ_found = TRUE; req_name = name; break; @@ -774,7 +780,6 @@ gst_element_request_pad_by_name (GstElement *element, const gchar *name) * * Returns: the pad to which a connection can be made */ - GstPad* gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad, GstCaps *filtercaps) { diff --git a/gst/gstpad.c b/gst/gstpad.c index 7b00de0..b8e05be 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2039,6 +2039,11 @@ name_is_valid (const gchar *name, GstPadPresence presence) " type '%%d' or '%%s' for GST_PAD_REQUEST padtemplate", name); return FALSE; } + if (str && (*(str+2) != '\0')) { + g_warning ("invalid name template %s: conversion specification must appear" + " at the end of the GST_PAD_REQUEST padtemplate name", name); + return FALSE; + } } return TRUE; diff --git a/gst/schedulers/Makefile.am b/gst/schedulers/Makefile.am index 8038929..a0b856d 100644 --- a/gst/schedulers/Makefile.am +++ b/gst/schedulers/Makefile.am @@ -14,8 +14,8 @@ libgststandardscheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstfastscheduler_la_SOURCES = gstfastscheduler.c libgstfastscheduler_la_CFLAGS = $(GST_CFLAGS) -libgstfastscheduler_la_LIBADD = $(GST_LIBS) ../libcothreads.la -libgstfastscheduler_la_LDFLAGS = @GST_LT_LDFLAGS@ +libgstfastscheduler_la_LIBADD = ../libcothreads.la +libgstfastscheduler_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) ## this is a REALLY evil hack ## but we need to keep it as long as we have libs/gst and libs/ext diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index c50e8c5..da40902 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -549,7 +549,7 @@ gst_filesrc_get (GstPad *pad) /* we're done, return the buffer */ src->curoffset += GST_BUFFER_SIZE(buf); - //g_object_notify (G_OBJECT (src), "offset"); + g_object_notify (G_OBJECT (src), "offset"); return buf; } @@ -590,7 +590,7 @@ gst_filesrc_open_file (GstFileSrc *src) /* now notify of the changes */ g_object_freeze_notify (G_OBJECT (src)); g_object_notify (G_OBJECT (src), "filesize"); - //g_object_notify (G_OBJECT (src), "offset"); + g_object_notify (G_OBJECT (src), "offset"); g_object_thaw_notify (G_OBJECT (src)); GST_FLAG_SET (src, GST_FILESRC_OPEN); @@ -614,7 +614,7 @@ gst_filesrc_close_file (GstFileSrc *src) /* and notify that things changed */ g_object_freeze_notify (G_OBJECT (src)); g_object_notify (G_OBJECT (src), "filesize"); - //g_object_notify (G_OBJECT (src), "offset"); + g_object_notify (G_OBJECT (src), "offset"); g_object_thaw_notify (G_OBJECT (src)); if (src->mapbuf) diff --git a/tools/gst-launch.c b/tools/gst-launch.c index 651d6b3..fda793a 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -43,15 +43,12 @@ property_change_callback (GObject *object, GstObject *orig, GParamSpec *pspec) { GValue value = { 0, }; /* the important thing is that value.type = 0 */ gchar *str = 0; - - if (pspec->flags & G_PARAM_READABLE) { + + /* let's not print these out for the offset property... */ + if (pspec->flags & G_PARAM_READABLE && strcmp (pspec->name, "offset") != 0) { g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); g_object_get_property (G_OBJECT (orig), pspec->name, &value); - /* fix current bug with g_strdup_value_contents not working with gint64 */ - if (G_IS_PARAM_SPEC_INT64 (pspec)) - str = g_strdup_printf ("%lld", g_value_get_int64 (&value)); - else - str = g_strdup_value_contents (&value); + str = g_strdup_value_contents (&value); g_print ("%s: %s = %s\n", GST_OBJECT_NAME (orig), pspec->name, str); g_free (str); g_value_unset(&value); @@ -162,8 +159,6 @@ main(int argc, char *argv[]) launch_argc = argc; launch_argv = argv; - //gst_schedulerfactory_set_default_name ("fast"); - /* make a null-terminated version of argv */ argvn = g_new0 (char *,argc); memcpy (argvn, argv+1, sizeof (char*) * (argc-1)); @@ -196,12 +191,12 @@ main(int argc, char *argv[]) exit (-1); } - if (!GST_FLAG_IS_SET (GST_OBJECT (pipeline), GST_BIN_SELF_ITERATING)) { + if (!GST_FLAG_IS_SET (GST_OBJECT (pipeline), GST_BIN_SELF_SCHEDULABLE)) { g_idle_add (idle_func, pipeline); gst_main (); } else { - g_print ("sleeping 100...\n"); - sleep (100); + g_print ("waiting for the state change...\n"); + gst_element_wait_state_change (pipeline); } gst_element_set_state (pipeline, GST_STATE_NULL); -- 2.7.4