+2004-02-11 David Schleef <ds@schleef.org>
+
+ * docs/gst/tmpl/gstcaps.sgml: Fix stuff that mentions GstProps
+ * docs/gst/tmpl/gstpadtemplate.sgml: same
+ * docs/gst/tmpl/gstreamer-unused.sgml: Remove GstProps
+ * gst/gstobject.c: (gst_object_set_name_default): Do the memleak
+ fixing dance.
+ * gst/gstutils.c: Remove disabled code that uses GstProps.
+ * gst/registries/gstxmlregistry.h: same
+ * docs/random/ds/0.9-suggested-changes: random notes
+
2004-02-11 kost@imn.htwk-leipzig.de
reviewed by: David Schleef <ds@schleef.org>
a list, which is then a GstCaps on its own.
</para>
<para>
-GstCaps are created with gst_caps_new(), which takes a name, a mime type and
-a pointer to a #GstProps. A convenience macro with a cleaner syntax is
-available to create a caps with GST_CAPS_NEW(). The following example shows how
-to create a GstCaps.
+GstCaps are created with gst_caps_new_simpl(), which takes a mime type and
+a list of arguments in sets of 3, terminated with NULL. Each set of 3
+arguments is the name of a field, the GType of the field, and the value
+of the field. The following example shows how to create a GstCaps.
<programlisting>
GstCaps *caps;
caps = gst_caps_new (
- "my_caps", /* capability name */
- "audio/raw", /* mime type */
- gst_props_new ( /* properties */
- "format", GST_PROPS_STRING ("float"),
- "channels", GST_PROPS_INT (5),
- NULL));
+ "audio/x-raw-int", /* mime type */
+ "channels", G_TYPE_INT, 5,
+ NULL);
</programlisting>
The following code example is equivalent to the above example:
<programlisting>
GstCaps *caps;
- caps = GST_CAPS_NEW (
- "my_caps", /* capability name */
- "audio/raw", /* mime type */
- "format", GST_PROPS_STRING ("float"),
- "channels", GST_PROPS_INT (5)
- );
+ caps = gst_caps_from_string ("audio/x-raw-int, channels = (int) 5");
</programlisting>
</para>
<para>
gst_caps_get_string(), gst_caps_get_float(), which all take a property name as an argument.
</para>
<para>
-The properties of the caps structure can be modified with gst_caps_set, which
-takes a list of key value pairs in the #GstProps syntax as shown by this example:
+The fields of the caps structure can be modified with gst_caps_set_simple,
+which takes the caps structure to be modified, a list of arguments in
+sets of 3, terminated by NULL. The format of these arguments is the
+same as above.
<programlisting>
GstCaps *caps;
....
- gst_caps_set (caps, "format", GST_PROPS_STRING ("int"), NULL);
- gst_caps_set (caps, "channels", GST_PROPS_INT (20), NULL);
+ gst_caps_set_simple (caps, "channels", G_TYPE_INT, 20, NULL);
</programlisting>
</para>
If you need a unique instance of a GstCaps you can use the convenient
GST_CAPS_FACTORY() macro as shown below.
<programlisting>
- GST_CAPS_FACTORY (my_caps,
- GST_CAPS_NEW (
- "caps1",
- "audio/raw",
- "format", GST_PROPS_STRING ("float"),
- "channels", GST_PROPS_INT (5)
- ),
- GST_CAPS_NEW (
- "caps2",
- "audio/raw",
- "format", GST_PROPS_STRING ("int"),
- "channels", GST_PROPS_INT (5)
+ GstStaticCaps my_caps = GST_STATIC_CAPS (
+ "audio/x-raw-float, "
+ "channels = (int) 5; "
+ "audio/x-raw-int, "
+ "channels = (int) 5"
)
)
void
some_function (void)
{
- GstCaps *caps = GST_CAPS_GET (my_caps);
+ GstCaps *caps = gst_caps_copy (gst_static_caps_get (&my_caps));
...
}
<!-- ##### SECTION See_Also ##### -->
<para>
-#GstProps, #GstPad
+#GstStructure, #GstPad
</para>
<!-- ##### MACRO GST_TYPE_CAPS ##### -->
<para>
The following code example shows the code to create a pad from a padtemplate.
<programlisting>
- GST_PAD_TEMPLATE_FACTORY (my_template_factory,
+ GstStaticPadTemplate my_template =
+ GST_STATIC_PAD_TEMPLATE (
"sink", /* the name of the pad */
GST_PAD_SINK, /* the direction of the pad */
GST_PAD_ALWAYS, /* when this pad will be present */
- GST_CAPS_NEW ( /* the capabilities of the padtemplate */
- "my_caps",
- "audio/raw",
- "format", GST_PROPS_STRING ("int"),
- "channels", GST_PROPS_INT_RANGE (1, 6)
+ GST_STATIC_CAPS ( /* the capabilities of the padtemplate */
+ "audio/x-raw-int, "
+ "channels = (int) [ 1, 6 ]"
)
)
@event: The event to operate on
-<!-- ##### MACRO GST_EVENT_INFO_PROPS ##### -->
-<para>
-The properties of the info event
-</para>
-
-@event: The event to query
-
<!-- ##### MACRO GST_EVENT_SEEK_FLUSH ##### -->
<para>
Qeury wether the seek event also needs a flush.
@name: The name of the plugin.
@init: The init function of this plugin.
-<!-- ##### MACRO GST_PROPS_BOOL_ID ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### MACRO GST_PROPS_ENTRY_IS_VARIABLE ##### -->
-<para>
-
-</para>
-
-@a:
-
-<!-- ##### MACRO GST_PROPS_FLOAT_RANGE_STRING ##### -->
-<para>
-
-</para>
-
-@a:
-@b:
-
-<!-- ##### MACRO GST_PROPS_FLOAT_STRING ##### -->
-<para>
-
-</para>
-
-@a:
-
-<!-- ##### MACRO GST_PROPS_FOURCC_ID ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### MACRO GST_PROPS_FOURCC_INT ##### -->
-<para>
-Create a fourcc property out of an integer value.
-</para>
-
-@a: the integer value
-
-<!-- ##### MACRO GST_PROPS_INT_ID ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### MACRO GST_PROPS_INT_RANGE_ID ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### MACRO GST_PROPS_LIST_ID ##### -->
-<para>
-
-</para>
-
-
<!-- ##### MACRO GST_QUEUE ##### -->
<para>
</para>
-<!-- ##### MACRO GST_TYPE_PROPS_TYPE ##### -->
-<para>
-
-</para>
-
-
<!-- ##### MACRO GST_TYPE_QUEUE ##### -->
<para>
</para>
-<!-- ##### TYPEDEF GstPropsFactoryEntry ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### TYPEDEF GstPropsFactory[] ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### ENUM GstPropsId ##### -->
-<para>
-
-</para>
-
-@GST_PROPS_END_ID_NUM:
-@GST_PROPS_LIST_ID_NUM:
-@GST_PROPS_INT_ID_NUM:
-@GST_PROPS_INT_RANGE_ID_NUM:
-@GST_PROPS_FOURCC_ID_NUM:
-@GST_PROPS_BOOL_ID_NUM:
-
-<!-- ##### TYPEDEF GstPropsListFactory[] ##### -->
-<para>
-
-</para>
-
-
<!-- ##### STRUCT GstQueue ##### -->
<para>
- gst_init() et al. need to work correctly when called multiple times
and from libraries, etc.
+ - gst_pad_get_pad_template_caps -> gst_pad_get_template_caps()
+
+
caps:
(Company:)
* may ever assign a name */
G_LOCK (object_name_mutex);
- if (!object_name_counts)
- object_name_counts = g_hash_table_new (g_str_hash, g_str_equal);
+ if (!object_name_counts) {
+ object_name_counts = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, NULL);
+ }
count = GPOINTER_TO_INT (g_hash_table_lookup (object_name_counts, type_name));
g_hash_table_insert (object_name_counts, g_strdup (type_name),
g_string_append_c (str, ' ');
}
-#if 0
-static void
-gst_print_props (GString *buf, gint indent, GList *props, gboolean showname)
-{
- GList *elem;
- guint width = 0;
- GstPropsType type;
-
- if (showname)
- for (elem = props; elem; elem = g_list_next (elem)) {
- GstPropsEntry *prop = elem->data;
- const gchar *name = gst_props_entry_get_name (prop);
-
- if (width < strlen (name))
- width = strlen (name);
- }
-
- for (elem = props; elem; elem = g_list_next (elem)) {
- GstPropsEntry *prop = elem->data;
-
- string_append_indent (buf, indent);
- if (showname) {
- const gchar *name = gst_props_entry_get_name (prop);
-
- g_string_append (buf, name);
- string_append_indent (buf, 2 + width - strlen (name));
- }
-
- type = gst_props_entry_get_props_type (prop);
- switch (type) {
- case GST_PROPS_INT_TYPE:
- {
- gint val;
- gst_props_entry_get_int (prop, &val);
- g_string_append_printf (buf, "%d (int)\n", val);
- break;
- }
- case GST_PROPS_INT_RANGE_TYPE:
- {
- gint min, max;
- gst_props_entry_get_int_range (prop, &min, &max);
- g_string_append_printf (buf, "%d - %d (int)\n", min, max);
- break;
- }
- case GST_PROPS_FLOAT_TYPE:
- {
- gfloat val;
- gst_props_entry_get_float (prop, &val);
- g_string_append_printf (buf, "%f (float)\n", val);
- break;
- }
- case GST_PROPS_FLOAT_RANGE_TYPE:
- {
- gfloat min, max;
- gst_props_entry_get_float_range (prop, &min, &max);
- g_string_append_printf (buf, "%f - %f (float)\n", min, max);
- break;
- }
- case GST_PROPS_BOOLEAN_TYPE:
- {
- gboolean val;
- gst_props_entry_get_boolean (prop, &val);
- g_string_append_printf (buf, "%s\n", val ? "TRUE" : "FALSE");
- break;
- }
- case GST_PROPS_STRING_TYPE:
- {
- const gchar *val;
- gst_props_entry_get_string (prop, &val);
- g_string_append_printf (buf, "\"%s\"\n", val);
- break;
- }
- case GST_PROPS_FOURCC_TYPE:
- {
- guint32 val;
- gst_props_entry_get_fourcc_int (prop, &val);
- g_string_append_printf (buf, "'%c%c%c%c' (fourcc)\n",
- (gchar)( val & 0xff),
- (gchar)((val >> 8) & 0xff),
- (gchar)((val >> 16) & 0xff),
- (gchar)((val >> 24) & 0xff));
- break;
- }
- case GST_PROPS_LIST_TYPE:
- {
- const GList *list;
- gst_props_entry_get_list (prop, &list);
- gst_print_props (buf, indent + 2, (GList *)list, FALSE);
- break;
- }
- default:
- g_string_append_printf (buf, "unknown proptype %d\n", type);
- break;
- }
- }
-}
-#endif
-
/**
* gst_print_pad_caps:
* @buf: the buffer to print the caps in
gchar *caps_name;
gchar *structure_name;
- //gchar *caps_mime;
- //GstProps *props;
gboolean in_list;
GList *entry_list;