From: Wim Taymans Date: Sat, 14 Apr 2001 18:56:37 +0000 (+0000) Subject: A rather large patch: X-Git-Tag: BRANCH-INCSCHED1-200104161-ROOT~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b38d9a945b327aee08cbafe95c3d7c72d7d5e024;p=platform%2Fupstream%2Fgstreamer.git A rather large patch: Original commit message from CVS: A rather large patch: - changed the API for the padtemplates: - remove the factories (array of pointers) for the padtemplates, properties and caps. The static array was a nice idea but converting all the property values to a gpointer was not a good idea. float properties were not possible, and casting a gint to a pointer is not very portable. The new API just uses the _padtemplate_new, _caps_new and _props_new functions to create the templates. This has the added benefit that the API is now uniform for static and dynamic templates and that the code can be made cleaner. - lots of cleanups in the way the capabilities are constructed (va_list) - lots of updates for all the plugins (new API) - docs updates (new API) - removed the videoraw docs. --- diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index ce1b132..ca9923f 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -444,15 +444,6 @@ GST_GPAD_REALPAD GstGhostPad gst_ghost_pad_new -GstPadFactoryEntry -GstPadFactory[] -GST_PAD_FACTORY_SOMETIMES -GST_PAD_FACTORY_ALWAYS -GST_PAD_FACTORY_REQUEST -GST_PAD_FACTORY_SINK -GST_PAD_FACTORY_SRC -GST_PAD_FACTORY_CAPS - GstPadPresence GstPadTemplate GST_PADTEMPLATE_CAPS @@ -460,7 +451,6 @@ GST_PADTEMPLATE_DIRECTION GST_PADTEMPLATE_NAME_TEMPLATE GST_PADTEMPLATE_PRESENCE gst_padtemplate_new -gst_padtemplate_create gst_padtemplate_load_thyself gst_padtemplate_save_thyself gst_padtemplate_get_caps @@ -498,7 +488,6 @@ GST_PADTEMPLATE_CLASS GST_IS_PADTEMPLATE GST_IS_PADTEMPLATE_CLASS gst_padtemplate_get_type -GST_PAD_FACTORY_CAPS_ID
@@ -627,16 +616,10 @@ GST_CAPS_LOCK GST_CAPS_TRYLOCK GST_CAPS_UNLOCK GstCaps -GstCapsFactory -GstCapsFactoryEntry -GstCapsFactory[] gst_caps_new -gst_caps_new_with_props gst_caps_destroy gst_caps_ref gst_caps_unref -gst_caps_register -gst_caps_register_count gst_caps_copy gst_caps_copy_on_write gst_caps_append @@ -668,8 +651,6 @@ GST_CAPS gstprops GstProps GstProps -GstPropsFactoryEntry -GstPropsFactory[] GST_MAKE_FOURCC GST_PROPS_LIST GST_PROPS_INT @@ -679,11 +660,8 @@ GST_PROPS_BOOLEAN GST_PROPS_STRING GST_PROPS_FLOAT GST_PROPS_FLOAT_RANGE -GST_PROPS_FLOAT_STRING -GST_PROPS_FLOAT_RANGE_STRING -gst_props_register -gst_props_register_count gst_props_new +gst_props_newv gst_props_merge gst_props_copy gst_props_copy_on_write @@ -700,18 +678,7 @@ gst_props_save_thyself gst_props_load_thyself GstPropsEntry -GstPropsListFactory[] GstPropsId -GST_PROPS_END_ID -GST_PROPS_LIST_ID -GST_PROPS_INT_ID -GST_PROPS_INT_RANGE_ID -GST_PROPS_FOURCC_ID -GST_PROPS_BOOL_ID -GST_PROPS_STRING_ID -GST_PROPS_LAST_ID -GST_PROPS_FLOAT_ID -GST_PROPS_FLOAT_RANGE_ID
diff --git a/docs/gst/tmpl/gstcaps.sgml b/docs/gst/tmpl/gstcaps.sgml index a5064df..9f1e9f3 100644 --- a/docs/gst/tmpl/gstcaps.sgml +++ b/docs/gst/tmpl/gstcaps.sgml @@ -51,24 +51,6 @@ Unlock the caps structure @properties: the properties of the capability @next: a pointer to the next caps. - - - - - - - - - - - - - - - - - - @@ -76,16 +58,6 @@ Unlock the caps structure @name: @mime: -@Returns: - - - - - - - -@name: -@mime: @props: @Returns: @@ -114,27 +86,6 @@ Unlock the caps structure @caps: - - - - - -@factory: -@Returns: - - - - - - - -@factory: -@counter: -@Returns: - -@count: - - diff --git a/docs/gst/tmpl/gstpad.sgml b/docs/gst/tmpl/gstpad.sgml index cccdb1a..bc51b8e 100644 --- a/docs/gst/tmpl/gstpad.sgml +++ b/docs/gst/tmpl/gstpad.sgml @@ -797,64 +797,6 @@ Get the real pad of this ghost pad. @Returns: - - -Defines an entry for a padfactory. - - - - - -The padfactory. - - - - - -Indicate that this pad will become available depending -on the media type. Use this in the factory definition. - - - - - - -Indicate that this pad will always be available. -Use this in the factory definition. - - - - - - -Indicates that this pad will be available on request. Use -this in the factory definition. - - - - - - -Indicates a sinkpad for the padfactory. - - - - - - -Indicates a srcpad for the padfactory. - - - - - - -Starts the declaration of a the capabilities for this padtemplate. - - -@a...: a capability factory - - Indicates when this pad will become available. @@ -912,20 +854,14 @@ Indicates when this pad will become available. -@factory: -@Returns: - - - - - - - @name_template: @direction: @presence: @caps: +@Varargs: @Returns: + +@factory: diff --git a/docs/gst/tmpl/gstprops.sgml b/docs/gst/tmpl/gstprops.sgml index f389964..2c5f0ea 100644 --- a/docs/gst/tmpl/gstprops.sgml +++ b/docs/gst/tmpl/gstprops.sgml @@ -24,18 +24,6 @@ GstCaps @lock: @properties: the properties - - - - - - - - - - - - @@ -117,49 +105,25 @@ Create a boolean property. @b: - - - - - -@a: - - - - - - - -@a: -@b: - - - - - - - -@factory: -@Returns: - - - + -@factory: -@counter: +@firstname: +@Varargs: @Returns: + +@entry: - + -@entry: -@Varargs: +@firstname: +@var_args: @Returns: @@ -235,10 +199,10 @@ Create a boolean property. @props: @name: -@entry: @Varargs: @Returns: +@entry: @value: diff --git a/docs/gst/tmpl/gstreamer-unused.sgml b/docs/gst/tmpl/gstreamer-unused.sgml index 80ebffd..c750b5e 100644 --- a/docs/gst/tmpl/gstreamer-unused.sgml +++ b/docs/gst/tmpl/gstreamer-unused.sgml @@ -207,6 +207,12 @@ the stream. @Returns: + + + + + + @@ -226,6 +232,17 @@ the stream. + + + + + +@name_template: +@direction: +@presence: +@caps: +@Returns: + @@ -610,6 +627,12 @@ Specify the current offset in the file. @Returns: + + + + + + @@ -899,6 +922,12 @@ The fequency. @obj: + + + + + + The buffer is sent to the sound card. @@ -960,6 +989,16 @@ The buffer is sent to the sound card. + + + + + +@factory: +@counter: +@Returns: +@count: + @@ -1151,6 +1190,12 @@ Flags for the GstSrc element GstColorSpace + + +Defines an entry for a padfactory. + + + @@ -1218,6 +1263,12 @@ GstColorSpace @Returns: + + +Indicates a sinkpad for the padfactory. + + + @@ -1376,6 +1427,13 @@ This macro sets the given flags. + + + + + +@a: + @@ -1444,6 +1502,12 @@ The frequency. + + +Indicates a srcpad for the padfactory. + + + @@ -1553,6 +1617,13 @@ The frequency. @name: @Returns: + + +Starts the declaration of a the capabilities for this padtemplate. + + +@a...: a capability factory + GstSrc @@ -1573,6 +1644,16 @@ GstSrc @pad: @buf: + + + + + +@name: +@mime: +@props: +@Returns: + @@ -1750,6 +1831,14 @@ Query whether this object has multiple input pads. + + + + + +@factory: +@Returns: + @@ -1796,6 +1885,12 @@ Information about video buffers. @klass: + + + + + + @@ -2051,6 +2146,23 @@ The start point of a filter graph @src: + + + + + +@factory: +@counter: +@Returns: + + + + + + +@a: +@b: + @@ -2110,6 +2222,13 @@ The start point of a filter graph @klass: <<<<<<< gstreamer-unused.sgml + + +Indicates that this pad will be available on request. Use +this in the factory definition. + + + @@ -2147,6 +2266,13 @@ This macro unsets the given state on the element. @pad: @id: + + +Indicate that this pad will always be available. +Use this in the factory definition. + + + @@ -2396,6 +2522,12 @@ Information about audio buffers. Take data in and spit data out + + +The padfactory. + + + This macro checks to see if the GST_SRC_ASYNC flag is set. @@ -2409,6 +2541,12 @@ This macro checks to see if the GST_SRC_ASYNC flag is set. + + + + + + @@ -2515,6 +2653,14 @@ Information about audio buffers. + + + + + +@factory: +@Returns: + @@ -2561,6 +2707,13 @@ Specify the location of the file to read. GstAudioSrc + + +Indicate that this pad will become available depending +on the media type. Use this in the factory definition. + + + diff --git a/docs/gst/tmpl/videoraw.sgml b/docs/gst/tmpl/videoraw.sgml deleted file mode 100644 index fda469c..0000000 --- a/docs/gst/tmpl/videoraw.sgml +++ /dev/null @@ -1,64 +0,0 @@ - -videoraw - - -Information about video buffers. - - - -Information about video buffers. - - - - - - - - - - - - -@meta: -@format: -@visual: -@width: -@height: -@overlay_info: -@dga_info: - - - - - - -@base: -@swidth: -@sheight: -@bytes_per_line: - - - - - - -@wx: -@wy: -@overlay_element: -@clip_count: -@overlay_clip: -@width: -@height: -@did_overlay: -@fully_obscured: - - - - - - -@x1: -@x2: -@y1: -@y2: - diff --git a/editor/gsteditorproperty.c b/editor/gsteditorproperty.c index ca77aed..9a787ce 100644 --- a/editor/gsteditorproperty.c +++ b/editor/gsteditorproperty.c @@ -248,16 +248,16 @@ static gchar* gst_editor_props_show_func (GstPropsEntry *entry) { switch (entry->propstype) { - case GST_PROPS_INT_ID_NUM: + case GST_PROPS_INT_ID: return g_strdup_printf ("%d", entry->data.int_data); break; - case GST_PROPS_INT_RANGE_ID_NUM: + case GST_PROPS_INT_RANGE_ID: return g_strdup_printf ("%d-%d", entry->data.int_range_data.min, entry->data.int_range_data.max); break; - case GST_PROPS_FOURCC_ID_NUM: + case GST_PROPS_FOURCC_ID: return g_strdup_printf ("%4.4s", (gchar *)&entry->data.fourcc_data); break; - case GST_PROPS_BOOL_ID_NUM: + case GST_PROPS_BOOL_ID: return g_strdup_printf ("%s", (entry->data.bool_data ? "TRUE" : "FALSE")); break; default: @@ -272,7 +272,7 @@ gst_editor_add_caps_to_tree (GstCaps *caps, GtkWidget *tree, GtkCTreeNode *padno if (caps) { GstProps *props = gst_caps_get_props (caps); if (props) { - GSList *propslist = props->properties; + GList *propslist = props->properties; while (propslist) { gchar *data[2]; @@ -281,7 +281,7 @@ gst_editor_add_caps_to_tree (GstCaps *caps, GtkWidget *tree, GtkCTreeNode *padno data[0] = g_quark_to_string (entry->propid); switch (entry->propstype) { - case GST_PROPS_LIST_ID_NUM: + case GST_PROPS_LIST_ID: { GList *list; guint count = 0; @@ -303,7 +303,7 @@ gst_editor_add_caps_to_tree (GstCaps *caps, GtkWidget *tree, GtkCTreeNode *padno gtk_ctree_insert_node (GTK_CTREE (tree), padnode, NULL, data, 0, NULL, NULL, NULL, NULL, TRUE, TRUE); - propslist = g_slist_next (propslist); + propslist = g_list_next (propslist); } } } @@ -357,14 +357,14 @@ gst_editor_pads_create (GstEditorProperty *property, GstEditorElement *element) pads = gst_element_get_padtemplate_list(realelement); while (pads) { GstPadTemplate *templ = (GstPadTemplate *)pads->data; - GList *caps = templ->caps; + GstCaps *caps = templ->caps; gchar *mime; gchar *data[2]; GtkCTreeNode *padnode; if (caps) { GstType *type; - type = gst_type_find_by_id (((GstCaps *)caps->data)->id); + type = gst_type_find_by_id (((GstCaps *)caps)->id); mime = type->mime; } else { @@ -377,11 +377,11 @@ gst_editor_pads_create (GstEditorProperty *property, GstEditorElement *element) NULL, NULL, NULL, NULL, FALSE, TRUE); while (caps) { - GstCaps *cap = (GstCaps *)caps->data; + GstCaps *cap = (GstCaps *)caps; gst_editor_add_caps_to_tree (cap, tree, padnode); - caps = g_list_next (caps); + caps = (caps)->next; } pads = g_list_next (pads); diff --git a/examples/plugins/example.c b/examples/plugins/example.c index dbe5b28..75e5c78 100644 --- a/examples/plugins/example.c +++ b/examples/plugins/example.c @@ -57,34 +57,41 @@ enum { * can have. They can be quite complex, but for this example plugin * they are rather simple. */ -static GstPadFactory sink_factory = { - "sink", /* The name of the pad */ - GST_PAD_FACTORY_SINK, /* Direction of the pad */ - GST_PAD_FACTORY_ALWAYS, /* The pad exists for every instance */ - GST_PAD_FACTORY_CAPS( /* This factory has specific capabilities */ - "example_sink", /* The name of the caps */ - "unknown/unknown", /* The overall MIME/type */ - "foo", GST_PROPS_INT (1), /* An integer property */ - "bar", GST_PROPS_BOOLEAN (TRUE), /* A boolean */ - "baz", GST_PROPS_LIST ( /* A list of values for */ - GST_PROPS_INT (1), - GST_PROPS_INT (3) - ) - ), - NULL /* All factories must be NULL-terminated */ -}; +static GstPadTemplate* +sink_factory (void) +{ + return + gst_padtemplate_new ( + "sink", /* The name of the pad */ + GST_PAD_SINK, /* Direction of the pad */ + GST_PAD_ALWAYS, /* The pad exists for every instance */ + gst_caps_new ( + "example_sink", /* The name of the caps */ + "unknown/unknown", /* The overall MIME/type */ + gst_props_new ( + "foo", GST_PROPS_INT (1), /* An integer property */ + "bar", GST_PROPS_BOOLEAN (TRUE), /* A boolean */ + "baz", GST_PROPS_LIST ( /* A list of values for */ + GST_PROPS_INT (1), + GST_PROPS_INT (3) + ), + NULL))); +} /* This factory is much simpler, and defines the source pad. */ -static GstPadFactory src_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "example_src", - "unknown/unknown" - ), - NULL -}; +static GstPadTemplate* +src_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "example_src", + "unknown/unknown", + NULL)); +} /* A number of functon prototypes are given so we can refer to them later. */ @@ -351,10 +358,10 @@ plugin_init (GModule *module) * Note that the generated padtemplates are stored in static global * variables, for the gst_example_init function to use later on. */ - sink_template = gst_padtemplate_new (&sink_factory); + sink_template = sink_factory (); gst_elementfactory_add_padtemplate (factory, sink_template); - src_template = gst_padtemplate_new (&src_factory); + src_template = src_factory (); gst_elementfactory_add_padtemplate (factory, src_template); /* The very last thing is to register the elementfactory with the plugin. */ diff --git a/gst/elements/gsttee.c b/gst/elements/gsttee.c index d444217..67ab4b1 100644 --- a/gst/elements/gsttee.c +++ b/gst/elements/gsttee.c @@ -45,13 +45,17 @@ enum { /* FILL ME */ }; -static GstPadFactory tee_src_factory = { - "src%d", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_REQUEST, - NULL, /* no caps */ - NULL, -}; +static GstPadTemplate* +tee_src_factory_create (void) +{ + return + gst_padtemplate_new ( + "src%d", + GST_PAD_SRC, + GST_PAD_REQUEST, + NULL /* no caps */ + ); +} static void gst_tee_class_init (GstTeeClass *klass); @@ -197,7 +201,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf) gboolean gst_tee_factory_init (GstElementFactory *factory) { - gst_tee_src_template = gst_padtemplate_new (&tee_src_factory); + gst_tee_src_template = tee_src_factory_create (); gst_elementfactory_add_padtemplate (factory, gst_tee_src_template); return TRUE; diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 31e7b5e..c77d9bd 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -62,13 +62,14 @@ get_type_for_mime (const gchar *mime) * gst_caps_new: * @name: the name of this capability * @mime: the mime type to attach to the capability + * @props: the properties to add to this capability * - * Create a new capability with the given mime type. + * Create a new capability with the given mime typei and properties. * * Returns: a new capability */ GstCaps* -gst_caps_new (const gchar *name, const gchar *mime) +gst_caps_new (const gchar *name, const gchar *mime, GstProps *props) { GstCaps *caps; @@ -80,7 +81,7 @@ gst_caps_new (const gchar *name, const gchar *mime) caps->name = g_strdup (name); caps->id = get_type_for_mime (mime); - caps->properties = NULL; + caps->properties = props; caps->next = NULL; caps->refcount = 1; caps->lock = g_mutex_new (); @@ -89,78 +90,6 @@ gst_caps_new (const gchar *name, const gchar *mime) } /** - * gst_caps_new_with_props: - * @name: the name of this capability - * @mime: the mime type to attach to the capability - * @props: the properties for this capability - * - * Create a new capability with the given mime type and the given properties. - * - * Returns: a new capability - */ -GstCaps* -gst_caps_new_with_props (const gchar *name, const gchar *mime, GstProps *props) -{ - GstCaps *caps; - - caps = gst_caps_new (name, mime); - caps->properties = props; - - return caps; -} - -/** - * gst_caps_register: - * @factory: the factory to register - * - * Register the factory. - * - * Returns: the registered capability - */ -GstCaps* -gst_caps_register (GstCapsFactory *factory) -{ - guint dummy; - - return gst_caps_register_count (factory, &dummy); -} - -/** - * gst_caps_register_count: - * @factory: the factory to register - * @counter: count how many entries were consumed - * - * Register the factory. - * - * Returns: the registered capability - */ -GstCaps* -gst_caps_register_count (GstCapsFactory *factory, guint *counter) -{ - GstCapsFactoryEntry tag; - gint i = 0; - gchar *name; - GstCaps *caps; - - g_return_val_if_fail (factory != NULL, NULL); - - tag = (*factory)[i++]; - g_return_val_if_fail (tag != NULL, NULL); - - name = tag; - - tag = (*factory)[i++]; - g_return_val_if_fail (tag != NULL, NULL); - - caps = gst_caps_new_with_props (name, (gchar *)tag, - gst_props_register_count (&(*factory)[i], counter)); - - *counter += 2; - - return caps; -} - -/** * gst_caps_destroy: * @caps: the caps to destroy * @@ -244,7 +173,7 @@ gst_caps_copy (GstCaps *caps) g_return_val_if_fail (caps != NULL, NULL); GST_CAPS_LOCK (caps); - new = gst_caps_new_with_props ( + new = gst_caps_new ( caps->name, (gst_type_find_by_id (caps->id))->mime, gst_props_copy (caps->properties)); diff --git a/gst/gstcaps.h b/gst/gstcaps.h index ff7ab84..c3c619e 100644 --- a/gst/gstcaps.h +++ b/gst/gstcaps.h @@ -36,12 +36,6 @@ #include typedef struct _GstCaps GstCaps; -typedef gpointer GstCapsFactoryEntry; -#ifdef __cplusplus -typedef GstCapsFactoryEntry * GstCapsFactory; -#else // C++ was unable to compile with this -typedef GstCapsFactoryEntry GstCapsFactory[]; -#endif #define GST_CAPS(caps) \ ((GstCaps *)(caps)) @@ -65,10 +59,7 @@ struct _GstCaps { /* initialize the subsystem */ void _gst_caps_initialize (void); -GstCaps* gst_caps_new (const gchar *name, const gchar *mime); -GstCaps* gst_caps_new_with_props (const gchar *name, const gchar *mime, GstProps *props); -GstCaps* gst_caps_register (GstCapsFactory *factory); -GstCaps* gst_caps_register_count (GstCapsFactory *factory, guint *counter); +GstCaps* gst_caps_new (const gchar *name, const gchar *mime, GstProps *props); void gst_caps_unref (GstCaps *caps); void gst_caps_ref (GstCaps *caps); diff --git a/gst/gstpad.c b/gst/gstpad.c index eca7d5f..c71757c 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -1397,48 +1397,6 @@ gst_padtemplate_init (GstPadTemplate *templ) } /** - * gst_padtemplate_new: - * @factory: the padfactory to use - * - * Creates a new padtemplate from the factory. - * - * Returns: the new padtemplate - */ -GstPadTemplate* -gst_padtemplate_new (GstPadFactory *factory) -{ - GstPadTemplate *new; - GstPadFactoryEntry tag; - gint i = 0; - guint counter = 0; - - g_return_val_if_fail (factory != NULL, NULL); - - new = gtk_type_new (gst_padtemplate_get_type ()); - - tag = (*factory)[i++]; - g_return_val_if_fail (tag != NULL, new); - new->name_template = g_strdup ((gchar *)tag); - - tag = (*factory)[i++]; - new->direction = GPOINTER_TO_UINT (tag); - - tag = (*factory)[i++]; - new->presence = GPOINTER_TO_UINT (tag); - - tag = (*factory)[i++]; - - while (GPOINTER_TO_INT (tag) == GST_PAD_FACTORY_CAPS_ID) { - GST_PADTEMPLATE_CAPS (new) = gst_caps_append (GST_PADTEMPLATE_CAPS (new), - gst_caps_register_count ((GstCapsFactory *)&(*factory)[i], &counter)); - i+=counter; - tag = (*factory)[i++]; - } - - return new; -} - -/** * gst_padtemplate_create: * @name_template: the name template * @direction: the direction for the template @@ -1450,11 +1408,13 @@ gst_padtemplate_new (GstPadFactory *factory) * Returns: the new padtemplate */ GstPadTemplate* -gst_padtemplate_create (gchar *name_template, - GstPadDirection direction, GstPadPresence presence, - GstCaps *caps) +gst_padtemplate_new (gchar *name_template, + GstPadDirection direction, GstPadPresence presence, + GstCaps *caps, ...) { GstPadTemplate *new; + va_list var_args; + GstCaps *thecaps = NULL; g_return_val_if_fail (name_template != NULL, NULL); @@ -1463,7 +1423,16 @@ gst_padtemplate_create (gchar *name_template, GST_PADTEMPLATE_NAME_TEMPLATE (new) = name_template; GST_PADTEMPLATE_DIRECTION (new) = direction; GST_PADTEMPLATE_PRESENCE (new) = presence; - GST_PADTEMPLATE_CAPS (new) = caps; + + va_start (var_args, caps); + + while (caps) { + thecaps = gst_caps_append (thecaps, caps); + caps = va_arg (var_args, GstCaps*); + } + va_end (var_args); + + GST_PADTEMPLATE_CAPS (new) = thecaps; return new; } @@ -1581,7 +1550,7 @@ gst_padtemplate_load_thyself (xmlNodePtr parent) field = field->next; } - factory = gst_padtemplate_create (name_template, direction, presence, caps); + factory = gst_padtemplate_new (name_template, direction, presence, caps, NULL); return factory; } diff --git a/gst/gstpad.h b/gst/gstpad.h index 2b915ac..a1332df 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -253,21 +253,6 @@ struct _GstPadTemplateClass { }; -/* factory */ -typedef gpointer GstPadFactoryEntry; -typedef GstPadFactoryEntry GstPadFactory[]; - -#define GST_PAD_FACTORY_ALWAYS GINT_TO_POINTER(GST_PAD_ALWAYS) -#define GST_PAD_FACTORY_SOMETIMES GINT_TO_POINTER(GST_PAD_SOMETIMES) -#define GST_PAD_FACTORY_REQUEST GINT_TO_POINTER(GST_PAD_REQUEST) - -#define GST_PAD_FACTORY_SRC GINT_TO_POINTER(GST_PAD_SRC) -#define GST_PAD_FACTORY_SINK GINT_TO_POINTER(GST_PAD_SINK) - -#define GST_PAD_FACTORY_CAPS_ID 1 -#define GST_PAD_FACTORY_CAPS(a...) GINT_TO_POINTER(GST_PAD_FACTORY_CAPS_ID),##a,NULL - - GtkType gst_pad_get_type (void); GtkType gst_real_pad_get_type (void); GtkType gst_ghost_pad_get_type (void); @@ -348,10 +333,9 @@ GstPad * gst_ghost_pad_new (gchar *name,GstPad *pad); /* templates and factories */ GtkType gst_padtemplate_get_type (void); -GstPadTemplate* gst_padtemplate_new (GstPadFactory *factory); -GstPadTemplate* gst_padtemplate_create (gchar *name_template, +GstPadTemplate* gst_padtemplate_new (gchar *name_template, GstPadDirection direction, GstPadPresence presence, - GstCaps *caps); + GstCaps *caps, ...); GstCaps* gst_padtemplate_get_caps (GstPadTemplate *templ); GstCaps* gst_padtemplate_get_caps_by_name (GstPadTemplate *templ, const gchar *name); diff --git a/gst/gstplugin.c b/gst/gstplugin.c index 6aa4c1b..2e5362a 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -364,6 +364,8 @@ gst_plugin_load_absolute (const gchar *name) module = g_module_open(name,G_MODULE_BIND_LAZY); if (module != NULL) { if (g_module_symbol(module,"plugin_init",(gpointer *)&initfunc)) { + GST_INFO (GST_CAT_PLUGIN_LOADING,"loading plugin \"%s\"...", + name); if ((plugin = (initfunc)(module))) { GST_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" loaded: %d elements, %d types", plugin->name,plugin->numelements,plugin->numtypes); diff --git a/gst/gstprops.c b/gst/gstprops.c index 5ba3eee..94a823b 100644 --- a/gst/gstprops.c +++ b/gst/gstprops.c @@ -34,18 +34,6 @@ static GMutex *_gst_props_chunk_lock; static gboolean gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry2); -static guint _arg_len[] = { - 0, // GST_PROPS_END_ID_NUM = 0, - 0, // GST_PROPS_LIST_ID_NUM, - 1, // GST_PROPS_INT_ID_NUM, - 2, // GST_PROPS_INT_RANGE_ID_NUM, - 1, // GST_PROPS_FLOAT_ID_NUM, - 2, // GST_PROPS_FLOAT_RANGE_ID_NUM, - 1, // GST_PROPS_FOURCC_ID_NUM, - 1, // GST_PROPS_BOOL_ID_NUM, - 1, // GST_PROPS_STRING_ID_NUM, -}; - void _gst_props_initialize (void) { @@ -67,16 +55,16 @@ gst_props_debug_entry (GstPropsEntry *entry) case GST_PROPS_INT_ID: GST_DEBUG (0, "%d\n", entry->data.int_data); break; - case GST_PROPS_FOURCC_ID_NUM: + case GST_PROPS_FOURCC_ID: GST_DEBUG (0, "%4.4s\n", (gchar*)&entry->data.fourcc_data); break; - case GST_PROPS_BOOL_ID_NUM: + case GST_PROPS_BOOL_ID: GST_DEBUG (0, "%d\n", entry->data.bool_data); break; - case GST_PROPS_STRING_ID_NUM: + case GST_PROPS_STRING_ID: GST_DEBUG (0, "%s\n", entry->data.string_data.string); break; - case GST_PROPS_INT_RANGE_ID_NUM: + case GST_PROPS_INT_RANGE_ID: GST_DEBUG (0, "%d-%d\n", entry->data.int_range_data.min, entry->data.int_range_data.max); break; @@ -85,67 +73,6 @@ gst_props_debug_entry (GstPropsEntry *entry) } } -static GstPropsEntry* -gst_props_create_entry (GstPropsFactory factory, gint *skipped) -{ - GstPropsFactoryEntry tag; - GstPropsEntry *entry; - guint i=0; - - g_mutex_lock (_gst_props_entries_chunk_lock); - entry = g_mem_chunk_alloc (_gst_props_entries_chunk); - g_mutex_unlock (_gst_props_entries_chunk_lock); - - tag = factory[i++]; - switch (GPOINTER_TO_INT (tag)) { - case GST_PROPS_INT_ID_NUM: - entry->propstype = GST_PROPS_INT_ID_NUM; - entry->data.int_data = GPOINTER_TO_INT (factory[i++]); - break; - case GST_PROPS_INT_RANGE_ID_NUM: - entry->propstype = GST_PROPS_INT_RANGE_ID_NUM; - entry->data.int_range_data.min = GPOINTER_TO_INT (factory[i++]); - entry->data.int_range_data.max = GPOINTER_TO_INT (factory[i++]); - break; - case GST_PROPS_FLOAT_ID_NUM: - entry->propstype = GST_PROPS_FLOAT_ID_NUM; - entry->data.float_data = *(gfloat*)factory[i++]; - break; - case GST_PROPS_FLOAT_RANGE_ID_NUM: - entry->propstype = GST_PROPS_FLOAT_RANGE_ID_NUM; - entry->data.float_range_data.min = *(gfloat*)factory[i++]; - entry->data.float_range_data.max = *(gfloat*)factory[i++]; - break; - case GST_PROPS_FOURCC_ID_NUM: - entry->propstype = GST_PROPS_FOURCC_ID_NUM; - entry->data.fourcc_data = GPOINTER_TO_INT (factory[i++]); - break; - case GST_PROPS_LIST_ID_NUM: - g_warning ("gstprops: list not allowed in list\n"); - break; - case GST_PROPS_BOOL_ID_NUM: - entry->propstype = GST_PROPS_BOOL_ID_NUM; - entry->data.bool_data = GPOINTER_TO_INT (factory[i++]); - break; - case GST_PROPS_STRING_ID_NUM: - entry->propstype = GST_PROPS_STRING_ID_NUM; - entry->data.string_data.string = g_strdup (factory[i++]); - break; - default: - g_warning ("gstprops: unknown props id found\n"); - g_mutex_lock (_gst_props_entries_chunk_lock); - g_mem_chunk_free (_gst_props_entries_chunk, entry); - g_mutex_unlock (_gst_props_entries_chunk_lock); - entry = NULL; - break; - } - - *skipped = i; - - return entry; -} - - static gint props_compare_func (gconstpointer a, gconstpointer b) @@ -166,184 +93,139 @@ props_find_func (gconstpointer a, return (entry1 - entry2->propid); } -/** - * gst_props_register: - * @factory: the factory to register - * - * Register the factory. - * - * Returns: the new property created from the factory - */ -GstProps * -gst_props_register (GstPropsFactory factory) +static void +gst_props_entry_fill (GstPropsEntry *entry, va_list *var_args) { - guint dummy; + entry->propstype = va_arg (*var_args, GstPropsId); - return gst_props_register_count (factory, &dummy); + switch (entry->propstype) { + case GST_PROPS_INT_ID: + entry->data.int_data = va_arg (*var_args, gint); + break; + case GST_PROPS_INT_RANGE_ID: + entry->data.int_range_data.min = va_arg (*var_args, gint); + entry->data.int_range_data.max = va_arg (*var_args, gint); + break; + case GST_PROPS_FLOAT_ID: + entry->data.float_data = va_arg (*var_args, gfloat); + break; + case GST_PROPS_FLOAT_RANGE_ID: + entry->data.float_range_data.min = va_arg (*var_args, gfloat); + entry->data.float_range_data.max = va_arg (*var_args, gfloat); + break; + case GST_PROPS_FOURCC_ID: + entry->data.fourcc_data = va_arg (*var_args, gulong); + break; + case GST_PROPS_BOOL_ID: + entry->data.bool_data = va_arg (*var_args, gboolean); + break; + case GST_PROPS_STRING_ID: + entry->data.string_data.string = g_strdup (va_arg (*var_args, gchar*)); + break; + default: + break; + } } /** - * gst_props_register_count: - * @factory: the factory to register - * @counter: count how many fields were consumed + * gst_props_new: + * @firstname: the first property name + * @...: the property values * - * Register the factory. + * Create a new property from the given key/value pairs * - * Returns: the new property created from the factory + * Returns: the new property */ -GstProps * -gst_props_register_count (GstPropsFactory factory, guint *counter) +GstProps* +gst_props_new (const gchar *firstname, ...) { - GstPropsFactoryEntry tag; - gint i = 0; - GstProps *props = NULL; - gint skipped; + GstProps *props; + va_list var_args; - g_return_val_if_fail (factory != NULL, NULL); - - tag = factory[i++]; - - if (!tag) goto end; - - g_mutex_lock (_gst_props_chunk_lock); - props = g_mem_chunk_alloc (_gst_props_chunk); - g_mutex_unlock (_gst_props_chunk_lock); + va_start (var_args, firstname); - g_return_val_if_fail (props != NULL, NULL); - - props->properties = NULL; - props->refcount = 1; + props = gst_props_newv (firstname, var_args); + + va_end (var_args); - while (tag) { - GQuark quark; - GstPropsEntry *entry; - - if (tag < GST_PROPS_LAST_ID) { - g_warning ("properties seem to be wrong\n"); - return NULL; - } - - quark = g_quark_from_string ((gchar *)tag); - - tag = factory[i]; - switch (GPOINTER_TO_INT (tag)) { - case GST_PROPS_LIST_ID_NUM: - { - GstPropsEntry *list_entry; - - g_mutex_lock (_gst_props_entries_chunk_lock); - entry = g_mem_chunk_alloc (_gst_props_entries_chunk); - g_mutex_unlock (_gst_props_entries_chunk_lock); - - entry->propid = quark; - entry->propstype = GST_PROPS_LIST_ID_NUM; - entry->data.list_data.entries = NULL; - - i++; // skip list tag - tag = factory[i]; - while (tag) { - list_entry = gst_props_create_entry (&factory[i], &skipped); - list_entry->propid = quark; - i += skipped; - tag = factory[i]; - entry->data.list_data.entries = g_list_prepend (entry->data.list_data.entries, list_entry); - } - entry->data.list_data.entries = g_list_reverse (entry->data.list_data.entries); - i++; //skip NULL (list end) - break; - } - default: - { - entry = gst_props_create_entry (&factory[i], &skipped); - entry->propid = quark; - i += skipped; - break; - } - } - props->properties = g_list_insert_sorted (props->properties, entry, props_compare_func); - - tag = factory[i++]; - } - -end: - *counter = i; - return props; } /** - * gst_props_new: - * @entry: the property entries for the property - * @...: the property entries for the property + * gst_props_newv: + * @firstname: the first property name + * @var_args: the property values * * Create a new property from the list of entries. * * Returns: the new property created from the list of entries */ GstProps* -gst_props_new (GstPropsFactoryEntry entry, ...) +gst_props_newv (const gchar *firstname, va_list var_args) { - va_list var_args; - GstPropsFactoryEntry value; - gint i = 0; - gint size, skip; - GstPropsFactoryEntry *factory; - gboolean inlist = FALSE; GstProps *props; + gboolean inlist = FALSE; + const gchar *prop_name; + GstPropsEntry *list_entry = NULL; -#define add_value(value) {\ - GST_DEBUG (0,"%d %p\n", i, value);\ - factory[i++] = value; \ - if (i >= size) { \ - size += 16; \ - factory = (GstPropsFactoryEntry *) g_realloc (factory, size*sizeof(GstPropsFactoryEntry));\ - }\ -} + g_mutex_lock (_gst_props_chunk_lock); + props = g_mem_chunk_alloc (_gst_props_chunk); + g_mutex_unlock (_gst_props_chunk_lock); + + props->properties = NULL; + props->refcount = 1; - size = 16; - factory = (GstPropsFactoryEntry *) g_malloc (size*sizeof(GstPropsFactoryEntry)); + prop_name = firstname; - va_start (var_args, entry); - // property name - value = (GstPropsFactoryEntry) entry; - // properties - while (value) { - if (!inlist) { - // add name - add_value (value); + while (prop_name) { + GstPropsEntry *entry; + + g_mutex_lock (_gst_props_entries_chunk_lock); + entry = g_mem_chunk_alloc (_gst_props_entries_chunk); + g_mutex_unlock (_gst_props_entries_chunk_lock); - // get value - value = va_arg (var_args, GstPropsFactoryEntry); - } - switch (GPOINTER_TO_INT (value)) { - case GST_PROPS_END_ID_NUM: - g_assert (inlist == TRUE); + entry->propid = g_quark_from_string (prop_name); + gst_props_entry_fill (entry, &var_args); - inlist = FALSE; - skip = 0; + switch (entry->propstype) { + case GST_PROPS_INT_ID: + case GST_PROPS_INT_RANGE_ID: + case GST_PROPS_FLOAT_ID: + case GST_PROPS_FLOAT_RANGE_ID: + case GST_PROPS_FOURCC_ID: + case GST_PROPS_BOOL_ID: + case GST_PROPS_STRING_ID: break; - case GST_PROPS_LIST_ID_NUM: - { - g_assert (inlist == FALSE); - - skip = 0; + case GST_PROPS_LIST_ID: + g_return_val_if_fail (inlist == FALSE, NULL); inlist = TRUE; + list_entry = entry; + list_entry->data.list_data.entries = NULL; break; - } + case GST_PROPS_END_ID: + g_return_val_if_fail (inlist == TRUE, NULL); + inlist = FALSE; + list_entry = NULL; + prop_name = va_arg (var_args, gchar*); + continue; default: - skip = _arg_len[GPOINTER_TO_INT (value)]; - break; + g_mutex_lock (_gst_props_entries_chunk_lock); + g_mem_chunk_free (_gst_props_entries_chunk, entry); + g_mutex_unlock (_gst_props_entries_chunk_lock); + g_assert_not_reached (); + break; } - do { - add_value (value); - value = va_arg (var_args, GstPropsFactoryEntry); + + if (inlist && (list_entry != entry)) { + list_entry->data.list_data.entries = g_list_prepend (list_entry->data.list_data.entries, entry); } - while (skip--); + else { + props->properties = g_list_insert_sorted (props->properties, entry, props_compare_func); + } + if (!inlist) + prop_name = va_arg (var_args, gchar*); } - factory[i++] = NULL; - - props = gst_props_register (factory); return props; } @@ -352,7 +234,6 @@ gst_props_new (GstPropsFactoryEntry entry, ...) * gst_props_set: * @props: the props to modify * @name: the name of the entry to modify - * @entry: The new value of the property entry * @...: More property entries. * * Modifies the value of the given entry in the props struct. @@ -360,7 +241,7 @@ gst_props_new (GstPropsFactoryEntry entry, ...) * Returns: the new modified property structure. */ GstProps* -gst_props_set (GstProps *props, const gchar *name, GstPropsFactoryEntry entry, ...) +gst_props_set (GstProps *props, const gchar *name, ...) { GQuark quark; GList *lentry; @@ -371,45 +252,15 @@ gst_props_set (GstProps *props, const gchar *name, GstPropsFactoryEntry entry, . lentry = g_list_find_custom (props->properties, GINT_TO_POINTER (quark), props_find_func); if (lentry) { - GstPropsEntry *thisentry; - GstPropsFactoryEntry value; + GstPropsEntry *entry; - thisentry = (GstPropsEntry *)lentry->data; + entry = (GstPropsEntry *)lentry->data; - va_start (var_args, entry); - // property name - value = (GstPropsFactoryEntry) entry; + va_start (var_args, name); - switch (GPOINTER_TO_INT (value)) { - case GST_PROPS_INT_ID: - thisentry->propstype = GST_PROPS_INT_ID_NUM; - value = va_arg (var_args, GstPropsFactoryEntry); - thisentry->data.int_data = GPOINTER_TO_INT (value); - break; - case GST_PROPS_FLOAT_ID: - thisentry->propstype = GST_PROPS_FLOAT_ID_NUM; - value = va_arg (var_args, GstPropsFactoryEntry); - thisentry->data.float_data = *(gfloat*)value; - break; - case GST_PROPS_FOURCC_ID_NUM: - thisentry->propstype = GST_PROPS_FOURCC_ID_NUM; - value = va_arg (var_args, GstPropsFactoryEntry); - thisentry->data.fourcc_data = GPOINTER_TO_INT (value); - break; - case GST_PROPS_BOOL_ID_NUM: - thisentry->propstype = GST_PROPS_BOOL_ID_NUM; - value = va_arg (var_args, GstPropsFactoryEntry); - thisentry->data.bool_data = GPOINTER_TO_INT (value); - break; - case GST_PROPS_STRING_ID_NUM: - thisentry->propstype = GST_PROPS_STRING_ID_NUM; - value = va_arg (var_args, GstPropsFactoryEntry); - thisentry->data.string_data.string = g_strdup (value); - break; - default: - g_print("gstprops: type not allowed\n"); - break; - } + gst_props_entry_fill (entry, &var_args); + + va_end (var_args); } else { g_print("gstprops: no property '%s' to change\n", name); @@ -736,7 +587,7 @@ gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry GST_DEBUG (0,"compare: %s %s\n", g_quark_to_string (entry1->propid), g_quark_to_string (entry2->propid)); switch (entry1->propstype) { - case GST_PROPS_LIST_ID_NUM: + case GST_PROPS_LIST_ID: { GList *entrylist = entry1->data.list_data.entries; gboolean valid = TRUE; // innocent until proven guilty @@ -751,90 +602,90 @@ gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry return valid; } - case GST_PROPS_INT_RANGE_ID_NUM: + case GST_PROPS_INT_RANGE_ID: switch (entry2->propstype) { // a - b <---> a - c - case GST_PROPS_INT_RANGE_ID_NUM: + case GST_PROPS_INT_RANGE_ID: return (entry2->data.int_range_data.min <= entry1->data.int_range_data.min && entry2->data.int_range_data.max >= entry1->data.int_range_data.max); - case GST_PROPS_LIST_ID_NUM: + case GST_PROPS_LIST_ID: return gst_props_entry_check_list_compatibility (entry1, entry2); default: return FALSE; } break; - case GST_PROPS_FLOAT_RANGE_ID_NUM: + case GST_PROPS_FLOAT_RANGE_ID: switch (entry2->propstype) { // a - b <---> a - c - case GST_PROPS_FLOAT_RANGE_ID_NUM: + case GST_PROPS_FLOAT_RANGE_ID: return (entry2->data.float_range_data.min <= entry1->data.float_range_data.min && entry2->data.float_range_data.max >= entry1->data.float_range_data.max); - case GST_PROPS_LIST_ID_NUM: + case GST_PROPS_LIST_ID: return gst_props_entry_check_list_compatibility (entry1, entry2); default: return FALSE; } break; - case GST_PROPS_FOURCC_ID_NUM: + case GST_PROPS_FOURCC_ID: switch (entry2->propstype) { // b <---> a - case GST_PROPS_FOURCC_ID_NUM: + case GST_PROPS_FOURCC_ID: return (entry2->data.fourcc_data == entry1->data.fourcc_data); // b <---> a,b,c - case GST_PROPS_LIST_ID_NUM: + case GST_PROPS_LIST_ID: return gst_props_entry_check_list_compatibility (entry1, entry2); default: return FALSE; } break; - case GST_PROPS_INT_ID_NUM: + case GST_PROPS_INT_ID: switch (entry2->propstype) { // b <---> a - d - case GST_PROPS_INT_RANGE_ID_NUM: + case GST_PROPS_INT_RANGE_ID: return (entry2->data.int_range_data.min <= entry1->data.int_data && entry2->data.int_range_data.max >= entry1->data.int_data); // b <---> a - case GST_PROPS_INT_ID_NUM: + case GST_PROPS_INT_ID: return (entry2->data.int_data == entry1->data.int_data); // b <---> a,b,c - case GST_PROPS_LIST_ID_NUM: + case GST_PROPS_LIST_ID: return gst_props_entry_check_list_compatibility (entry1, entry2); default: return FALSE; } break; - case GST_PROPS_FLOAT_ID_NUM: + case GST_PROPS_FLOAT_ID: switch (entry2->propstype) { // b <---> a - d - case GST_PROPS_FLOAT_RANGE_ID_NUM: + case GST_PROPS_FLOAT_RANGE_ID: return (entry2->data.float_range_data.min <= entry1->data.float_data && entry2->data.float_range_data.max >= entry1->data.float_data); // b <---> a - case GST_PROPS_FLOAT_ID_NUM: + case GST_PROPS_FLOAT_ID: return (entry2->data.float_data == entry1->data.float_data); // b <---> a,b,c - case GST_PROPS_LIST_ID_NUM: + case GST_PROPS_LIST_ID: return gst_props_entry_check_list_compatibility (entry1, entry2); default: return FALSE; } break; - case GST_PROPS_BOOL_ID_NUM: + case GST_PROPS_BOOL_ID: switch (entry2->propstype) { // t <---> t - case GST_PROPS_BOOL_ID_NUM: + case GST_PROPS_BOOL_ID: return (entry2->data.bool_data == entry1->data.bool_data); - case GST_PROPS_LIST_ID_NUM: + case GST_PROPS_LIST_ID: return gst_props_entry_check_list_compatibility (entry1, entry2); default: return FALSE; } - case GST_PROPS_STRING_ID_NUM: + case GST_PROPS_STRING_ID: switch (entry2->propstype) { // t <---> t - case GST_PROPS_STRING_ID_NUM: + case GST_PROPS_STRING_ID: return (!strcmp (entry2->data.string_data.string, entry1->data.string_data.string)); - case GST_PROPS_LIST_ID_NUM: + case GST_PROPS_LIST_ID: return gst_props_entry_check_list_compatibility (entry1, entry2); default: return FALSE; @@ -924,14 +775,14 @@ gst_props_save_thyself_func (GstPropsEntry *entry, xmlNodePtr parent) gchar *str; switch (entry->propstype) { - case GST_PROPS_INT_ID_NUM: + case GST_PROPS_INT_ID: subtree = xmlNewChild (parent, NULL, "int", NULL); xmlNewProp (subtree, "name", g_quark_to_string (entry->propid)); str = g_strdup_printf ("%d", entry->data.int_data); xmlNewProp (subtree, "value", str); g_free(str); break; - case GST_PROPS_INT_RANGE_ID_NUM: + case GST_PROPS_INT_RANGE_ID: subtree = xmlNewChild (parent, NULL, "range", NULL); xmlNewProp (subtree, "name", g_quark_to_string (entry->propid)); str = g_strdup_printf ("%d", entry->data.int_range_data.min); @@ -941,14 +792,14 @@ gst_props_save_thyself_func (GstPropsEntry *entry, xmlNodePtr parent) xmlNewProp (subtree, "max", str); g_free(str); break; - case GST_PROPS_FLOAT_ID_NUM: + case GST_PROPS_FLOAT_ID: subtree = xmlNewChild (parent, NULL, "float", NULL); xmlNewProp (subtree, "name", g_quark_to_string (entry->propid)); str = g_strdup_printf ("%f", entry->data.float_data); xmlNewProp (subtree, "value", str); g_free(str); break; - case GST_PROPS_FLOAT_RANGE_ID_NUM: + case GST_PROPS_FLOAT_RANGE_ID: subtree = xmlNewChild (parent, NULL, "floatrange", NULL); xmlNewProp (subtree, "name", g_quark_to_string (entry->propid)); str = g_strdup_printf ("%f", entry->data.float_range_data.min); @@ -958,7 +809,7 @@ gst_props_save_thyself_func (GstPropsEntry *entry, xmlNodePtr parent) xmlNewProp (subtree, "max", str); g_free(str); break; - case GST_PROPS_FOURCC_ID_NUM: + case GST_PROPS_FOURCC_ID: str = g_strdup_printf ("%4.4s", (gchar *)&entry->data.fourcc_data); xmlAddChild (parent, xmlNewComment (str)); g_free(str); @@ -968,12 +819,12 @@ gst_props_save_thyself_func (GstPropsEntry *entry, xmlNodePtr parent) xmlNewProp (subtree, "hexvalue", str); g_free(str); break; - case GST_PROPS_BOOL_ID_NUM: + case GST_PROPS_BOOL_ID: subtree = xmlNewChild (parent, NULL, "boolean", NULL); xmlNewProp (subtree, "name", g_quark_to_string (entry->propid)); xmlNewProp (subtree, "value", (entry->data.bool_data ? "true" : "false")); break; - case GST_PROPS_STRING_ID_NUM: + case GST_PROPS_STRING_ID: subtree = xmlNewChild (parent, NULL, "string", NULL); xmlNewProp (subtree, "name", g_quark_to_string (entry->propid)); xmlNewProp (subtree, "value", entry->data.string_data.string); @@ -1008,7 +859,7 @@ gst_props_save_thyself (GstProps *props, xmlNodePtr parent) GstPropsEntry *entry = (GstPropsEntry *) proplist->data; switch (entry->propstype) { - case GST_PROPS_LIST_ID_NUM: + case GST_PROPS_LIST_ID: subtree = xmlNewChild (parent, NULL, "list", NULL); xmlNewProp (subtree, "name", g_quark_to_string (entry->propid)); g_list_foreach (entry->data.list_data.entries, (GFunc) gst_props_save_thyself_func, subtree); @@ -1033,7 +884,7 @@ gst_props_load_thyself_func (xmlNodePtr field) g_mutex_unlock (_gst_props_entries_chunk_lock); if (!strcmp(field->name, "int")) { - entry->propstype = GST_PROPS_INT_ID_NUM; + entry->propstype = GST_PROPS_INT_ID; prop = xmlGetProp(field, "name"); entry->propid = g_quark_from_string (prop); g_free (prop); @@ -1042,7 +893,7 @@ gst_props_load_thyself_func (xmlNodePtr field) g_free (prop); } else if (!strcmp(field->name, "range")) { - entry->propstype = GST_PROPS_INT_RANGE_ID_NUM; + entry->propstype = GST_PROPS_INT_RANGE_ID; prop = xmlGetProp(field, "name"); entry->propid = g_quark_from_string (prop); g_free (prop); @@ -1054,7 +905,7 @@ gst_props_load_thyself_func (xmlNodePtr field) g_free (prop); } else if (!strcmp(field->name, "float")) { - entry->propstype = GST_PROPS_FLOAT_ID_NUM; + entry->propstype = GST_PROPS_FLOAT_ID; prop = xmlGetProp(field, "name"); entry->propid = g_quark_from_string (prop); g_free (prop); @@ -1063,7 +914,7 @@ gst_props_load_thyself_func (xmlNodePtr field) g_free (prop); } else if (!strcmp(field->name, "floatrange")) { - entry->propstype = GST_PROPS_FLOAT_RANGE_ID_NUM; + entry->propstype = GST_PROPS_FLOAT_RANGE_ID; prop = xmlGetProp(field, "name"); entry->propid = g_quark_from_string (prop); g_free (prop); @@ -1075,7 +926,7 @@ gst_props_load_thyself_func (xmlNodePtr field) g_free (prop); } else if (!strcmp(field->name, "boolean")) { - entry->propstype = GST_PROPS_BOOL_ID_NUM; + entry->propstype = GST_PROPS_BOOL_ID; prop = xmlGetProp(field, "name"); entry->propid = g_quark_from_string (prop); g_free (prop); @@ -1085,7 +936,7 @@ gst_props_load_thyself_func (xmlNodePtr field) g_free (prop); } else if (!strcmp(field->name, "fourcc")) { - entry->propstype = GST_PROPS_FOURCC_ID_NUM; + entry->propstype = GST_PROPS_FOURCC_ID; prop = xmlGetProp(field, "name"); entry->propid = g_quark_from_string (prop); g_free (prop); @@ -1094,7 +945,7 @@ gst_props_load_thyself_func (xmlNodePtr field) g_free (prop); } else if (!strcmp(field->name, "string")) { - entry->propstype = GST_PROPS_STRING_ID_NUM; + entry->propstype = GST_PROPS_STRING_ID; prop = xmlGetProp(field, "name"); entry->propid = g_quark_from_string (prop); g_free (prop); @@ -1141,7 +992,7 @@ gst_props_load_thyself (xmlNodePtr parent) entry = g_mem_chunk_alloc (_gst_props_entries_chunk); g_mutex_unlock (_gst_props_entries_chunk_lock); - entry->propstype = GST_PROPS_LIST_ID_NUM; + entry->propstype = GST_PROPS_LIST_ID; entry->data.list_data.entries = NULL; prop = xmlGetProp (field, "name"); entry->propid = g_quark_from_string (prop); @@ -1171,8 +1022,3 @@ gst_props_load_thyself (xmlNodePtr parent) return props; } - -gfloat* _gst_props_floatpointer (gfloat f) -{ - return &f; -} diff --git a/gst/gstprops.h b/gst/gstprops.h index 93ee078..a67acf8 100644 --- a/gst/gstprops.h +++ b/gst/gstprops.h @@ -36,45 +36,29 @@ typedef struct _GstProps GstProps; -typedef gpointer GstPropsFactoryEntry; -typedef GstPropsFactoryEntry GstPropsFactory[]; -typedef GstPropsFactory *GstPropsListFactory[]; typedef enum { - GST_PROPS_END_ID_NUM = 0, - GST_PROPS_LIST_ID_NUM, - GST_PROPS_INT_ID_NUM, - GST_PROPS_INT_RANGE_ID_NUM, - GST_PROPS_FLOAT_ID_NUM, - GST_PROPS_FLOAT_RANGE_ID_NUM, - GST_PROPS_FOURCC_ID_NUM, - GST_PROPS_BOOL_ID_NUM, - GST_PROPS_STRING_ID_NUM, - GST_PROPS_LAST_ID_NUM = GST_PROPS_END_ID_NUM + 16, + GST_PROPS_END_ID = 0, + GST_PROPS_LIST_ID, + GST_PROPS_INT_ID, + GST_PROPS_INT_RANGE_ID, + GST_PROPS_FLOAT_ID, + GST_PROPS_FLOAT_RANGE_ID, + GST_PROPS_FOURCC_ID, + GST_PROPS_BOOL_ID, + GST_PROPS_STRING_ID, + GST_PROPS_LAST_ID = GST_PROPS_END_ID + 16, } GstPropsId; -#define GST_PROPS_END_ID GINT_TO_POINTER(GST_PROPS_END_ID_NUM) -#define GST_PROPS_LIST_ID GINT_TO_POINTER(GST_PROPS_LIST_ID_NUM) -#define GST_PROPS_INT_ID GINT_TO_POINTER(GST_PROPS_INT_ID_NUM) -#define GST_PROPS_INT_RANGE_ID GINT_TO_POINTER(GST_PROPS_INT_RANGE_ID_NUM) -#define GST_PROPS_FLOAT_ID GINT_TO_POINTER(GST_PROPS_FLOAT_ID_NUM) -#define GST_PROPS_FLOAT_RANGE_ID GINT_TO_POINTER(GST_PROPS_FLOAT_RANGE_ID_NUM) -#define GST_PROPS_FOURCC_ID GINT_TO_POINTER(GST_PROPS_FOURCC_ID_NUM) -#define GST_PROPS_BOOL_ID GINT_TO_POINTER(GST_PROPS_BOOL_ID_NUM) -#define GST_PROPS_STRING_ID GINT_TO_POINTER(GST_PROPS_STRING_ID_NUM) -#define GST_PROPS_LAST_ID GINT_TO_POINTER(GST_PROPS_LAST_ID_NUM) - #define GST_MAKE_FOURCC(a,b,c,d) ((a)|(b)<<8|(c)<<16|(d)<<24) #define GST_PROPS_LIST(a...) GST_PROPS_LIST_ID,##a,NULL -#define GST_PROPS_INT(a) GST_PROPS_INT_ID,(GINT_TO_POINTER(a)) -#define GST_PROPS_INT_RANGE(a,b) GST_PROPS_INT_RANGE_ID,(GINT_TO_POINTER(a)),(GINT_TO_POINTER(b)) -#define GST_PROPS_FLOAT_STRING(a) GST_PROPS_FLOAT_ID,(a) -#define GST_PROPS_FLOAT_RANGE_STRING(a,b) GST_PROPS_FLOAT_RANGE_ID,(a),(b) -#define GST_PROPS_FLOAT(a) GST_PROPS_FLOAT_ID,(&(a)) -#define GST_PROPS_FLOAT_RANGE(a,b) GST_PROPS_FLOAT_RANGE_ID,(&(a)),(&(b)) -#define GST_PROPS_FOURCC(a) GST_PROPS_FOURCC_ID,(GINT_TO_POINTER(a)) -#define GST_PROPS_BOOLEAN(a) GST_PROPS_BOOL_ID,(GINT_TO_POINTER(a)) +#define GST_PROPS_INT(a) GST_PROPS_INT_ID,(a) +#define GST_PROPS_INT_RANGE(a,b) GST_PROPS_INT_RANGE_ID,(a),(b) +#define GST_PROPS_FLOAT(a) GST_PROPS_FLOAT_ID,(a) +#define GST_PROPS_FLOAT_RANGE(a,b) GST_PROPS_FLOAT_RANGE_ID,(a),(b) +#define GST_PROPS_FOURCC(a) GST_PROPS_FOURCC_ID,(a) +#define GST_PROPS_BOOLEAN(a) GST_PROPS_BOOL_ID,(a) #define GST_PROPS_STRING(a) GST_PROPS_STRING_ID,(a) @@ -88,10 +72,8 @@ struct _GstProps { /* initialize the subsystem */ void _gst_props_initialize (void); -GstProps* gst_props_register (GstPropsFactory factory); -GstProps* gst_props_register_count (GstPropsFactory factory, guint *counter); - -GstProps* gst_props_new (GstPropsFactoryEntry entry, ...); +GstProps* gst_props_new (const gchar *firstname, ...); +GstProps* gst_props_newv (const gchar *firstname, va_list var_args); void gst_props_unref (GstProps *props); void gst_props_ref (GstProps *props); @@ -104,7 +86,7 @@ GstProps* gst_props_merge (GstProps *props, GstProps *tomerge); gboolean gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops); -GstProps* gst_props_set (GstProps *props, const gchar *name, GstPropsFactoryEntry entry, ...); +GstProps* gst_props_set (GstProps *props, const gchar *name, ...); gint gst_props_get_int (GstProps *props, const gchar *name); gulong gst_props_get_fourcc_int (GstProps *props, const gchar *name); diff --git a/gst/meta/Makefile.am b/gst/meta/Makefile.am index fe7553e..388fd45 100644 --- a/gst/meta/Makefile.am +++ b/gst/meta/Makefile.am @@ -1,3 +1,3 @@ metaincludedir = $(includedir)/gst/meta metainclude_HEADERS = \ - videoraw.h.old + spectrum.h diff --git a/gstplay/Makefile.am b/gstplay/Makefile.am index 1dcc03c..9439600 100644 --- a/gstplay/Makefile.am +++ b/gstplay/Makefile.am @@ -25,11 +25,14 @@ libgstmediaplay_la_SOURCES = \ gstmediaplay_SOURCES = \ main.c +libgstmediaplayincludedir = $(includedir)/gstplay +libgstmediaplayinclude_HEADERS = \ + gstplay.h + noinst_HEADERS = \ gstmediaplay.h \ gststatusarea.h \ callbacks.h \ - gstplay.h \ gstplayprivate.h diff --git a/gstplay/gstplay.c b/gstplay/gstplay.c index 09f1212..e8898ef 100644 --- a/gstplay/gstplay.c +++ b/gstplay/gstplay.c @@ -423,6 +423,8 @@ gst_play_realize (GtkWidget *widget) g_return_if_fail (GST_IS_PLAY (widget)); + //g_print ("realize\n"); + play = GST_PLAY (widget); priv = (GstPlayPrivate *)play->priv; diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c index d444217..67ab4b1 100644 --- a/plugins/elements/gsttee.c +++ b/plugins/elements/gsttee.c @@ -45,13 +45,17 @@ enum { /* FILL ME */ }; -static GstPadFactory tee_src_factory = { - "src%d", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_REQUEST, - NULL, /* no caps */ - NULL, -}; +static GstPadTemplate* +tee_src_factory_create (void) +{ + return + gst_padtemplate_new ( + "src%d", + GST_PAD_SRC, + GST_PAD_REQUEST, + NULL /* no caps */ + ); +} static void gst_tee_class_init (GstTeeClass *klass); @@ -197,7 +201,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf) gboolean gst_tee_factory_init (GstElementFactory *factory) { - gst_tee_src_template = gst_padtemplate_new (&tee_src_factory); + gst_tee_src_template = tee_src_factory_create (); gst_elementfactory_add_padtemplate (factory, gst_tee_src_template); return TRUE; diff --git a/tests/autoplug.c b/tests/autoplug.c index 70de69b..2898e64 100644 --- a/tests/autoplug.c +++ b/tests/autoplug.c @@ -22,7 +22,7 @@ main (int argc, char *argv[]) g_assert (videosink != NULL); testcaps = g_list_append (NULL, - gst_caps_new_with_props ("test_caps", + gst_caps_new ("test_caps", "video/mpeg", gst_props_new ( "mpegversion", GST_PROPS_INT (1), diff --git a/tests/autoplug2.c b/tests/autoplug2.c index 64f0a9f..8076fa2 100644 --- a/tests/autoplug2.c +++ b/tests/autoplug2.c @@ -3,10 +3,10 @@ static GstElement* autoplug_caps (GstAutoplug *autoplug, gchar *mime1, gchar *mime2) { - GList *caps1, *caps2; + GstCaps *caps1, *caps2; - caps1 = g_list_append (NULL, gst_caps_new ("tescaps1", mime1)); - caps2 = g_list_append (NULL, gst_caps_new ("tescaps2", mime2)); + caps1 = gst_caps_new ("tescaps1", mime1, NULL); + caps2 = gst_caps_new ("tescaps2", mime2, NULL); return gst_autoplug_to_caps (autoplug, caps1, caps2, NULL); } @@ -28,48 +28,48 @@ main (int argc, char *argv[]) xmlSaveFile ("autoplug2_2.gst", gst_xml_write (element)); element = gst_autoplug_to_caps (autoplug, - g_list_append (NULL, gst_caps_new_with_props( + gst_caps_new( "testcaps3", "video/mpeg", gst_props_new ( "mpegversion", GST_PROPS_INT (1), "systemstream", GST_PROPS_BOOLEAN (TRUE), - NULL))), - g_list_append (NULL, gst_caps_new("testcaps4","audio/raw")), + NULL)), + gst_caps_new("testcaps4","audio/raw", NULL), NULL); xmlSaveFile ("autoplug2_3.gst", gst_xml_write (element)); element = gst_autoplug_to_caps (autoplug, - g_list_append (NULL, gst_caps_new_with_props( + gst_caps_new( "testcaps5", "video/mpeg", gst_props_new ( "mpegversion", GST_PROPS_INT (1), "systemstream", GST_PROPS_BOOLEAN (FALSE), - NULL))), - g_list_append (NULL, gst_caps_new("testcaps6", "video/raw")), + NULL)), + gst_caps_new("testcaps6", "video/raw", NULL), NULL); xmlSaveFile ("autoplug2_4.gst", gst_xml_write (element)); element = gst_autoplug_to_caps (autoplug, - g_list_append (NULL, gst_caps_new( + gst_caps_new( "testcaps7", - "video/avi")), - g_list_append (NULL, gst_caps_new("testcaps8", "video/raw")), - g_list_append (NULL, gst_caps_new("testcaps9", "audio/raw")), + "video/avi", NULL), + gst_caps_new("testcaps8", "video/raw", NULL), + gst_caps_new("testcaps9", "audio/raw", NULL), NULL); xmlSaveFile ("autoplug2_5.gst", gst_xml_write (element)); element = gst_autoplug_to_caps (autoplug, - g_list_append (NULL, gst_caps_new_with_props( + gst_caps_new( "testcaps10", "video/mpeg", gst_props_new ( "mpegversion", GST_PROPS_INT (1), "systemstream", GST_PROPS_BOOLEAN (TRUE), - NULL))), - g_list_append (NULL, gst_caps_new("testcaps10", "video/raw")), - g_list_append (NULL, gst_caps_new("testcaps11", "audio/raw")), + NULL)), + gst_caps_new("testcaps10", "video/raw", NULL), + gst_caps_new("testcaps11", "audio/raw", NULL), NULL); xmlSaveFile ("autoplug2_6.gst", gst_xml_write (element)); diff --git a/tests/autoplug3.c b/tests/autoplug3.c index 9f6a150..34927ed 100644 --- a/tests/autoplug3.c +++ b/tests/autoplug3.c @@ -17,64 +17,64 @@ main (int argc, char *argv[]) autoplug2 = gst_autoplugfactory_make ("static"); element = gst_autoplug_to_renderers (autoplug, - g_list_append (NULL, gst_caps_new ("mp3caps", "audio/mp3")), sink2, NULL); + gst_caps_new ("mp3caps", "audio/mp3", NULL), sink2, NULL); xmlSaveFile ("autoplug3_1.gst", gst_xml_write (element)); element = gst_autoplug_to_renderers (autoplug, - g_list_append (NULL, gst_caps_new ("mpeg1caps", "video/mpeg")), sink1, NULL); + gst_caps_new ("mpeg1caps", "video/mpeg", NULL), sink1, NULL); if (element) { xmlSaveFile ("autoplug3_2.gst", gst_xml_write (element)); } element = gst_autoplug_to_caps (autoplug2, - g_list_append (NULL, gst_caps_new_with_props( + gst_caps_new( "testcaps3", "video/mpeg", gst_props_new ( "mpegversion", GST_PROPS_INT (1), "systemstream", GST_PROPS_BOOLEAN (TRUE), - NULL))), - g_list_append (NULL, gst_caps_new("testcaps4","audio/raw")), + NULL)), + gst_caps_new("testcaps4","audio/raw", NULL), NULL); if (element) { xmlSaveFile ("autoplug3_3.gst", gst_xml_write (element)); } element = gst_autoplug_to_caps (autoplug2, - g_list_append (NULL, gst_caps_new_with_props( + gst_caps_new( "testcaps5", "video/mpeg", gst_props_new ( "mpegversion", GST_PROPS_INT (1), "systemstream", GST_PROPS_BOOLEAN (FALSE), - NULL))), - g_list_append (NULL, gst_caps_new("testcaps6", "video/raw")), + NULL)), + gst_caps_new("testcaps6", "video/raw", NULL), NULL); if (element) { xmlSaveFile ("autoplug3_4.gst", gst_xml_write (element)); } element = gst_autoplug_to_caps (autoplug2, - g_list_append (NULL, gst_caps_new( + gst_caps_new( "testcaps7", - "video/avi")), - g_list_append (NULL, gst_caps_new("testcaps8", "video/raw")), - g_list_append (NULL, gst_caps_new("testcaps9", "audio/raw")), + "video/avi", NULL), + gst_caps_new("testcaps8", "video/raw", NULL), + gst_caps_new("testcaps9", "audio/raw", NULL), NULL); if (element) { xmlSaveFile ("autoplug3_5.gst", gst_xml_write (element)); } element = gst_autoplug_to_caps (autoplug2, - g_list_append (NULL, gst_caps_new_with_props( + gst_caps_new( "testcaps10", "video/mpeg", gst_props_new ( "mpegversion", GST_PROPS_INT (1), "systemstream", GST_PROPS_BOOLEAN (TRUE), - NULL))), - g_list_append (NULL, gst_caps_new("testcaps10", "video/raw")), - g_list_append (NULL, gst_caps_new("testcaps11", "audio/raw")), + NULL)), + gst_caps_new("testcaps10", "video/raw", NULL), + gst_caps_new("testcaps11", "audio/raw", NULL), NULL); if (element) { xmlSaveFile ("autoplug3_6.gst", gst_xml_write (element)); @@ -84,13 +84,13 @@ main (int argc, char *argv[]) sink2 = gst_elementfactory_make ("osssink", "osssink"); element = gst_autoplug_to_renderers (autoplug, - g_list_append (NULL, gst_caps_new_with_props( + gst_caps_new( "testcaps10", "video/mpeg", gst_props_new ( "mpegversion", GST_PROPS_INT (1), "systemstream", GST_PROPS_BOOLEAN (TRUE), - NULL))), + NULL)), sink1, sink2, NULL); diff --git a/tests/caps.c b/tests/caps.c index 047b4ba..97dc963 100644 --- a/tests/caps.c +++ b/tests/caps.c @@ -1,57 +1,110 @@ #include -static GstCapsFactory mpeg2dec_sink_caps = { - "mpeg2dec_sink", - "video/mpeg", - "mpegtype", GST_PROPS_LIST ( - GST_PROPS_INT(1), - GST_PROPS_INT(2) - ), - NULL -}; - -static GstCapsFactory mp1parse_src_caps = { - "mp1parse_src", - "video/mpeg", - "mpegtype", GST_PROPS_LIST ( - GST_PROPS_INT(1) - ), - NULL -}; - -static GstCapsFactory mpeg2dec_src_caps = { - "mpeg2dec_src", - "video/raw", - "fourcc", GST_PROPS_LIST ( - GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')), - GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')) - ), - "width", GST_PROPS_INT_RANGE (16, 4096), - "height", GST_PROPS_INT_RANGE (16, 4096), - NULL -}; - -static GstCapsFactory raw_sink_caps = { - "raw_sink_caps", - "video/raw", - "fourcc", GST_PROPS_LIST ( - GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')) +static GstCaps* +mpeg2dec_sink_caps (void) +{ + return + gst_caps_new ( + "mpeg2dec_sink", + "video/mpeg", + gst_props_new ( + "mpegtype", GST_PROPS_LIST ( + GST_PROPS_INT(1), + GST_PROPS_INT(2) + ), + NULL + ) + ); +} + +static GstCaps* +mp1parse_src_caps (void) +{ + return + gst_caps_new ( + "mp1parse_src", + "video/mpeg", + gst_props_new ( + "mpegtype", GST_PROPS_LIST ( + GST_PROPS_INT(1) + ), + NULL + ) + ); +} + +static GstCaps* +mpeg2dec_src_caps (void) +{ + return + gst_caps_new ( + "mpeg2dec_src", + "video/raw", + gst_props_new ( + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')), + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')) ), - "height", GST_PROPS_INT_RANGE (16, 256), - NULL -}; - -static GstCapsFactory raw2_sink_caps = { - "raw2_sink_caps", - "video/raw", - "fourcc", GST_PROPS_LIST ( + "width", GST_PROPS_INT_RANGE (16, 4096), + "height", GST_PROPS_INT_RANGE (16, 4096), + NULL + ) + ); +} + +static GstCaps* +raw_sink_caps (void) +{ + return + gst_caps_new ( + "raw_sink_caps", + "video/raw", + gst_props_new ( + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')) + ), + "height", GST_PROPS_INT_RANGE (16, 256), + NULL + ) + ); +} + +static GstCaps* +raw2_sink_caps (void) +{ + return + gst_caps_new ( + "raw2_sink_caps", + "video/raw", + gst_props_new ( + "fourcc", GST_PROPS_LIST ( GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')), - GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','V')) - ), - "height", GST_PROPS_INT_RANGE (16, 4096), - NULL -}; + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')) + ), + "height", GST_PROPS_INT_RANGE (16, 4096), + NULL + ) + ); +} + +static GstCaps* +get_testcaps (void) +{ + return + gst_caps_new ( + "raw2_sink_caps", + "video/raw", + gst_props_new ( + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')), + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','V')) + ), + "height", GST_PROPS_INT_RANGE (16, 4096), + NULL + ) + ); +} static GstCaps *sinkcaps = NULL, *rawcaps = NULL, @@ -59,7 +112,8 @@ static GstCaps *sinkcaps = NULL, *rawcaps3 = NULL, *mp1parsecaps = NULL; -int main(int argc,char *argv[]) +int +main (int argc, char *argv[]) { gboolean testret; xmlDocPtr doc; @@ -68,25 +122,28 @@ int main(int argc,char *argv[]) doc = xmlNewDoc ("1.0"); doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL); + g_thread_init (NULL); _gst_type_initialize (); + _gst_props_initialize (); + _gst_caps_initialize (); - sinkcaps = gst_caps_register (&mpeg2dec_sink_caps); + sinkcaps = mpeg2dec_sink_caps (); parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); gst_caps_save_thyself (sinkcaps, parent); - rawcaps = gst_caps_register (&mpeg2dec_src_caps); + rawcaps = mpeg2dec_src_caps (); parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL); gst_caps_save_thyself (rawcaps, parent); - rawcaps2 = gst_caps_register (&raw_sink_caps); + rawcaps2 = raw_sink_caps (); parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities3", NULL); gst_caps_save_thyself (rawcaps2, parent); - mp1parsecaps = gst_caps_register (&mp1parse_src_caps); + mp1parsecaps = mp1parse_src_caps (); parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities4", NULL); gst_caps_save_thyself (mp1parsecaps, parent); - rawcaps3 = gst_caps_register (&raw2_sink_caps); + rawcaps3 = raw2_sink_caps (); parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities5", NULL); gst_caps_save_thyself (rawcaps3, parent); diff --git a/tests/old/examples/plugins/example.c b/tests/old/examples/plugins/example.c index dbe5b28..75e5c78 100644 --- a/tests/old/examples/plugins/example.c +++ b/tests/old/examples/plugins/example.c @@ -57,34 +57,41 @@ enum { * can have. They can be quite complex, but for this example plugin * they are rather simple. */ -static GstPadFactory sink_factory = { - "sink", /* The name of the pad */ - GST_PAD_FACTORY_SINK, /* Direction of the pad */ - GST_PAD_FACTORY_ALWAYS, /* The pad exists for every instance */ - GST_PAD_FACTORY_CAPS( /* This factory has specific capabilities */ - "example_sink", /* The name of the caps */ - "unknown/unknown", /* The overall MIME/type */ - "foo", GST_PROPS_INT (1), /* An integer property */ - "bar", GST_PROPS_BOOLEAN (TRUE), /* A boolean */ - "baz", GST_PROPS_LIST ( /* A list of values for */ - GST_PROPS_INT (1), - GST_PROPS_INT (3) - ) - ), - NULL /* All factories must be NULL-terminated */ -}; +static GstPadTemplate* +sink_factory (void) +{ + return + gst_padtemplate_new ( + "sink", /* The name of the pad */ + GST_PAD_SINK, /* Direction of the pad */ + GST_PAD_ALWAYS, /* The pad exists for every instance */ + gst_caps_new ( + "example_sink", /* The name of the caps */ + "unknown/unknown", /* The overall MIME/type */ + gst_props_new ( + "foo", GST_PROPS_INT (1), /* An integer property */ + "bar", GST_PROPS_BOOLEAN (TRUE), /* A boolean */ + "baz", GST_PROPS_LIST ( /* A list of values for */ + GST_PROPS_INT (1), + GST_PROPS_INT (3) + ), + NULL))); +} /* This factory is much simpler, and defines the source pad. */ -static GstPadFactory src_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "example_src", - "unknown/unknown" - ), - NULL -}; +static GstPadTemplate* +src_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "example_src", + "unknown/unknown", + NULL)); +} /* A number of functon prototypes are given so we can refer to them later. */ @@ -351,10 +358,10 @@ plugin_init (GModule *module) * Note that the generated padtemplates are stored in static global * variables, for the gst_example_init function to use later on. */ - sink_template = gst_padtemplate_new (&sink_factory); + sink_template = sink_factory (); gst_elementfactory_add_padtemplate (factory, sink_template); - src_template = gst_padtemplate_new (&src_factory); + src_template = src_factory (); gst_elementfactory_add_padtemplate (factory, src_template); /* The very last thing is to register the elementfactory with the plugin. */ diff --git a/tests/props.c b/tests/props.c index 8a9d3bb..572af7a 100644 --- a/tests/props.c +++ b/tests/props.c @@ -1,22 +1,24 @@ #include -static GstPropsFactory mpeg2dec_sink_props = { - "mpegtype", GST_PROPS_LIST ( +static GstProps* mpeg2dec_sink_props_register (void) { + return gst_props_new ( + "mpegtype", GST_PROPS_LIST ( GST_PROPS_INT(1), GST_PROPS_INT(2) ), - NULL -}; + NULL); +} -static GstPropsFactory mpeg2dec_src_props = { - "fourcc", GST_PROPS_LIST ( +static GstProps* mpeg2dec_src_props_register (void) { + return gst_props_new ( + "fourcc", GST_PROPS_LIST ( GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')), GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')) ), - "width", GST_PROPS_INT_RANGE (16, 4096), - "height", GST_PROPS_INT_RANGE (16, 4096), - NULL -}; + "width", GST_PROPS_INT_RANGE (16, 4096), + "height", GST_PROPS_INT_RANGE (16, 4096), + NULL); +} static GstProps *sinkprops = NULL, *rawprops = NULL, @@ -31,13 +33,14 @@ int main(int argc,char *argv[]) doc = xmlNewDoc ("1.0"); doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Properties", NULL); - _gst_type_initialize (); + g_thread_init (NULL); + _gst_props_initialize (); - sinkprops = gst_props_register (mpeg2dec_sink_props); + sinkprops = mpeg2dec_sink_props_register (); parent = xmlNewChild (doc->xmlRootNode, NULL, "Props1", NULL); gst_props_save_thyself (sinkprops, parent); - rawprops = gst_props_register (mpeg2dec_src_props); + rawprops = mpeg2dec_src_props_register (); parent = xmlNewChild (doc->xmlRootNode, NULL, "Props2", NULL); gst_props_save_thyself (rawprops, parent); diff --git a/tools/gstreamer-inspect.c b/tools/gstreamer-inspect.c index 86e4f07..e18c5f4 100644 --- a/tools/gstreamer-inspect.c +++ b/tools/gstreamer-inspect.c @@ -15,25 +15,25 @@ void print_prop(GstPropsEntry *prop,gboolean showname,gchar *pfx) { printf(pfx); switch (prop->propstype) { - case GST_PROPS_INT_ID_NUM: + case GST_PROPS_INT_ID: printf("Integer: %d\n",prop->data.int_data); break; - case GST_PROPS_INT_RANGE_ID_NUM: + case GST_PROPS_INT_RANGE_ID: printf("Integer range: %d - %d\n",prop->data.int_range_data.min, prop->data.int_range_data.max); break; - case GST_PROPS_BOOL_ID_NUM: + case GST_PROPS_BOOL_ID: printf("Boolean: %s\n",prop->data.bool_data ? "TRUE" : "FALSE"); break; - case GST_PROPS_STRING_ID_NUM: + case GST_PROPS_STRING_ID: printf("String: %s\n",prop->data.string_data.string); break; - case GST_PROPS_FOURCC_ID_NUM: + case GST_PROPS_FOURCC_ID: printf("FourCC: %c%c%c%c\n", prop->data.fourcc_data & 0xff,prop->data.fourcc_data>>8 & 0xff, prop->data.fourcc_data>>16 & 0xff,prop->data.fourcc_data>>24 & 0xff); break; - case GST_PROPS_LIST_ID_NUM: + case GST_PROPS_LIST_ID: printf("List:\n"); longprefix = g_strdup_printf("%s ",pfx); list = prop->data.list_data.entries;