gst/gstcaps.*: Fix docs and indentation again.

Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_merge_structure):
* gst/gstcaps.h:
Fix docs and indentation again.
* tests/check/gst/gstquery.c: (GST_START_TEST):
Fix leak in tests and add some more tests.
This commit is contained in:
Wim Taymans 2006-08-28 16:39:20 +00:00
parent 8b6246f275
commit a0dbcd9ee4
4 changed files with 68 additions and 49 deletions

View file

@ -1,3 +1,12 @@
2006-08-28 Wim Taymans <wim@fluendo.com>
* gst/gstcaps.c: (gst_caps_merge_structure):
* gst/gstcaps.h:
Fix docs and indentation again.
* tests/check/gst/gstquery.c: (GST_START_TEST):
Fix leak in tests and add some more tests.
2006-08-28 Edward Hervey <edward@fluendo.com>
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times):

View file

@ -701,40 +701,36 @@ gst_caps_remove_structure (GstCaps * caps, guint idx)
* structure is not copied; @caps becomes the owner of @structure.
*/
void
gst_caps_merge_structure (GstCaps * caps, GstStructure * structure2)
gst_caps_merge_structure (GstCaps * caps, GstStructure * structure)
{
g_return_if_fail (GST_IS_CAPS (caps));
g_return_if_fail (IS_WRITABLE (caps));
if (G_LIKELY (structure2)) {
if (G_LIKELY (structure)) {
GstStructure *structure1;
int i;
gboolean unique = TRUE;
g_return_if_fail (structure2->parent_refcount == NULL);
g_return_if_fail (structure->parent_refcount == NULL);
#if 0
#ifdef USE_POISONING
STRUCTURE_POISON (structure2);
STRUCTURE_POISON (structure);
#endif
#endif
/*GST_DEBUG ("merge ?: %" GST_PTR_FORMAT, structure2); */
/* check each structure */
for (i = caps->structs->len - 1; i >= 0; i--) {
structure1 = gst_caps_get_structure (caps, i);
/*GST_DEBUG (" with: %" GST_PTR_FORMAT, structure1); */
/* if structure2 is a subset of structure1, then skip it */
if (gst_caps_structure_is_subset (structure1, structure2)) {
/*GST_DEBUG (" no"); */
/* if structure is a subset of structure1, then skip it */
if (gst_caps_structure_is_subset (structure1, structure)) {
unique = FALSE;
break;
}
}
if (unique) {
/*GST_DEBUG (" yes"); */
gst_structure_set_parent_refcount (structure2, &caps->refcount);
g_ptr_array_add (caps->structs, structure2);
gst_structure_set_parent_refcount (structure, &caps->refcount);
g_ptr_array_add (caps->structs, structure);
} else {
gst_structure_free (structure2);
gst_structure_free (structure);
}
}
}

View file

@ -199,8 +199,8 @@ void gst_caps_merge (GstCaps *caps1,
void gst_caps_append_structure (GstCaps *caps,
GstStructure *structure);
void gst_caps_remove_structure (GstCaps *caps, guint idx);
void gst_caps_merge_structure (GstCaps * caps1,
GstStructure * structure2);
void gst_caps_merge_structure (GstCaps *caps,
GstStructure *structure);
guint gst_caps_get_size (const GstCaps *caps);
GstStructure * gst_caps_get_structure (const GstCaps *caps,
guint index);

View file

@ -79,7 +79,7 @@ GST_START_TEST (create_queries)
GstFormat format;
gint64 start, stop;
format = GST_FORMAT_TIME;
format = GST_FORMAT_BYTES;
query = gst_query_new_segment (format);
fail_if (query == NULL);
@ -88,10 +88,24 @@ GST_START_TEST (create_queries)
gst_query_parse_segment (query, &rate, &format, &start, &stop);
/* see if empty gives undefined formats */
fail_if (rate == 1.0);
fail_if (format != GST_FORMAT_TIME);
fail_if (rate != 0.0);
fail_if (format != GST_FORMAT_BYTES);
fail_if (start != -1);
fail_if (stop != -1);
/* change all values */
gst_query_set_segment (query, 2.0, GST_FORMAT_TIME, 1 * GST_SECOND,
3 * GST_SECOND);
gst_query_parse_segment (query, &rate, &format, &start, &stop);
/* see if the values were changed */
fail_if (rate != 2.0);
fail_if (format != GST_FORMAT_TIME);
fail_if (start != 1 * GST_SECOND);
fail_if (stop != 3 * GST_SECOND);
gst_query_unref (query);
}
/* FORMATS */