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:
Andy Wingo 2002-03-18 04:41:37 +00:00
parent 8087b55e47
commit a43fadec2e
19 changed files with 103 additions and 34 deletions

View file

@ -59,14 +59,14 @@ enum {
/* 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 */

View file

@ -101,7 +101,7 @@ gst_disksink_class_init (GstDiskSinkClass *klass)
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);

View file

@ -113,7 +113,7 @@ gst_fakesink_class_init (GstFakeSinkClass *klass)
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,

View file

@ -236,7 +236,7 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
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,

View file

@ -89,7 +89,7 @@ gst_fdsink_class_init (GstFdSinkClass *klass)
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);

View file

@ -98,7 +98,7 @@ gst_fdsrc_class_init (GstFdSrcClass *klass)
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,

View file

@ -149,7 +149,7 @@ gst_filesrc_class_init (GstFileSrcClass *klass)
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,

View file

@ -890,6 +890,9 @@ gst_bin_iterate (GstBin * 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));
if (oclass->iterate)

View file

@ -63,8 +63,11 @@ 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 + 4,
GST_BIN_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 5,
} GstBinFlags;
/*typedef struct _GstBin GstBin; */

View file

@ -712,28 +712,40 @@ gst_element_request_pad_by_name (GstElement *element, const gchar *name)
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;
}
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)
@ -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
* @first_name: the first in a NULL terminated
* 'name', 'id', 'flags' triplet list.
@ -1886,7 +1898,7 @@ gst_element_populate_std_props (GObjectClass * klass,
* 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)
{

View file

@ -243,7 +243,7 @@ void gst_element_error (GstElement *element, const gchar *error, ...);
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);

View file

@ -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:
* @name_template: the name template
@ -2032,6 +2067,9 @@ gst_padtemplate_new (gchar *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;

View file

@ -101,7 +101,7 @@ gst_disksink_class_init (GstDiskSinkClass *klass)
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);

View file

@ -113,7 +113,7 @@ gst_fakesink_class_init (GstFakeSinkClass *klass)
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,

View file

@ -236,7 +236,7 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
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,

View file

@ -89,7 +89,7 @@ gst_fdsink_class_init (GstFdSinkClass *klass)
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);

View file

@ -98,7 +98,7 @@ gst_fdsrc_class_init (GstFdSrcClass *klass)
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,

View file

@ -149,7 +149,7 @@ gst_filesrc_class_init (GstFileSrcClass *klass)
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,

View file

@ -198,8 +198,13 @@ main(int argc, char *argv[])
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();