* length check */
#define gst_caps_get_structure_unchecked(caps, index) \
((GstStructure *)g_ptr_array_index ((caps)->structs, (index)))
-
+/* quick way to append a structure without checking the args */
+#define gst_caps_append_structure_unchecked(caps, structure) G_STMT_START{\
+ GstStructure *s=structure; \
+ gst_structure_set_parent_refcount (s, &caps->refcount); \
+ g_ptr_array_add (caps->structs, s); \
+}G_STMT_END
/* lock to protect multiple invocations of static caps to caps conversion */
G_LOCK_DEFINE_STATIC (static_caps_lock);
structure = gst_structure_new_valist (media_type, fieldname, var_args);
va_end (var_args);
- gst_caps_append_structure (caps, structure);
+ gst_caps_append_structure_unchecked (caps, structure);
return caps;
}
caps = gst_caps_new_empty ();
while (structure) {
- gst_caps_append_structure (caps, structure);
+ gst_caps_append_structure_unchecked (caps, structure);
structure = va_arg (var_args, GstStructure *);
}
for (i = 0; i < n; i++) {
structure = gst_caps_get_structure_unchecked (caps, i);
- gst_caps_append_structure (newcaps, gst_structure_copy (structure));
+ gst_caps_append_structure_unchecked (newcaps,
+ gst_structure_copy (structure));
}
return newcaps;
} else {
for (i = caps2->structs->len; i; i--) {
structure = gst_caps_remove_and_get_structure (caps2, 0);
- gst_caps_append_structure (caps1, structure);
+ gst_caps_append_structure_unchecked (caps1, structure);
}
}
gst_caps_unref (caps2); /* guaranteed to free it */
STRUCTURE_POISON (structure);
#endif
#endif
- gst_structure_set_parent_refcount (structure, &caps->refcount);
- g_ptr_array_add (caps->structs, structure);
+ gst_caps_append_structure_unchecked (caps, structure);
}
}
if (G_LIKELY (caps->structs->len > nth)) {
structure = gst_caps_get_structure_unchecked (caps, nth);
- gst_caps_append_structure (newcaps, gst_structure_copy (structure));
+ gst_caps_append_structure_unchecked (newcaps,
+ gst_structure_copy (structure));
}
return newcaps;
GSList *walk;
for (walk = list; walk; walk = g_slist_next (walk)) {
- gst_caps_append_structure (dest, (GstStructure *) walk->data);
+ gst_caps_append_structure_unchecked (dest,
+ (GstStructure *) walk->data);
}
g_slist_free (list);
} else {
- gst_caps_append_structure (dest, gst_structure_copy (min));
+ gst_caps_append_structure_unchecked (dest, gst_structure_copy (min));
}
} else {
- gst_caps_append_structure (dest, gst_structure_copy (min));
+ gst_caps_append_structure_unchecked (dest, gst_structure_copy (min));
}
}
if (CAPS_IS_EMPTY_SIMPLE (dest)) {
GstStructure *structure = gst_structure_copy (nf->structure);
gst_structure_id_set_value (structure, field_id, v);
- gst_caps_append_structure (nf->caps, structure);
+ gst_caps_append_structure_unchecked (nf->caps, structure);
}
gst_value_init_and_copy (&val, gst_value_list_get_value (value, 0));
if (structure == NULL) {
return FALSE;
}
- gst_caps_append_structure (caps, structure);
+ gst_caps_append_structure_unchecked (caps, structure);
do {
if (structure == NULL) {
return FALSE;
}
- gst_caps_append_structure (caps, structure);
+ gst_caps_append_structure_unchecked (caps, structure);
} while (TRUE);