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> 2006-08-28 Edward Hervey <edward@fluendo.com>
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times): * 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. * structure is not copied; @caps becomes the owner of @structure.
*/ */
void 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 (GST_IS_CAPS (caps));
g_return_if_fail (IS_WRITABLE (caps)); g_return_if_fail (IS_WRITABLE (caps));
if (G_LIKELY (structure2)) { if (G_LIKELY (structure)) {
GstStructure *structure1; GstStructure *structure1;
int i; int i;
gboolean unique = TRUE; gboolean unique = TRUE;
g_return_if_fail (structure2->parent_refcount == NULL); g_return_if_fail (structure->parent_refcount == NULL);
#if 0 #if 0
#ifdef USE_POISONING #ifdef USE_POISONING
STRUCTURE_POISON (structure2); STRUCTURE_POISON (structure);
#endif #endif
#endif #endif
/*GST_DEBUG ("merge ?: %" GST_PTR_FORMAT, structure2); */
/* check each structure */ /* check each structure */
for (i = caps->structs->len - 1; i >= 0; i--) { for (i = caps->structs->len - 1; i >= 0; i--) {
structure1 = gst_caps_get_structure (caps, i); structure1 = gst_caps_get_structure (caps, i);
/*GST_DEBUG (" with: %" GST_PTR_FORMAT, structure1); */ /* if structure is a subset of structure1, then skip it */
/* if structure2 is a subset of structure1, then skip it */ if (gst_caps_structure_is_subset (structure1, structure)) {
if (gst_caps_structure_is_subset (structure1, structure2)) {
/*GST_DEBUG (" no"); */
unique = FALSE; unique = FALSE;
break; break;
} }
} }
if (unique) { if (unique) {
/*GST_DEBUG (" yes"); */ gst_structure_set_parent_refcount (structure, &caps->refcount);
gst_structure_set_parent_refcount (structure2, &caps->refcount); g_ptr_array_add (caps->structs, structure);
g_ptr_array_add (caps->structs, structure2);
} else { } else {
gst_structure_free (structure2); gst_structure_free (structure);
} }
} }
} }

View file

@ -183,10 +183,10 @@ GstCaps * gst_caps_new_full_valist (GstStructure *structure,
va_list var_args); va_list var_args);
/* reference counting */ /* reference counting */
GstCaps * gst_caps_ref (GstCaps* caps); GstCaps * gst_caps_ref (GstCaps *caps);
GstCaps * gst_caps_copy (const GstCaps * caps); GstCaps * gst_caps_copy (const GstCaps *caps);
GstCaps * gst_caps_make_writable (GstCaps *caps); GstCaps * gst_caps_make_writable (GstCaps *caps);
void gst_caps_unref (GstCaps* caps); void gst_caps_unref (GstCaps *caps);
GType gst_static_caps_get_type (void); GType gst_static_caps_get_type (void);
GstCaps * gst_static_caps_get (GstStaticCaps *static_caps); GstCaps * gst_static_caps_get (GstStaticCaps *static_caps);
@ -198,14 +198,14 @@ void gst_caps_merge (GstCaps *caps1,
GstCaps *caps2); GstCaps *caps2);
void gst_caps_append_structure (GstCaps *caps, void gst_caps_append_structure (GstCaps *caps,
GstStructure *structure); GstStructure *structure);
void gst_caps_remove_structure (GstCaps * caps, guint idx); void gst_caps_remove_structure (GstCaps *caps, guint idx);
void gst_caps_merge_structure (GstCaps * caps1, void gst_caps_merge_structure (GstCaps *caps,
GstStructure * structure2); GstStructure *structure);
guint gst_caps_get_size (const GstCaps *caps); guint gst_caps_get_size (const GstCaps *caps);
GstStructure * gst_caps_get_structure (const GstCaps *caps, GstStructure * gst_caps_get_structure (const GstCaps *caps,
guint index); guint index);
GstCaps * gst_caps_copy_nth (const GstCaps * caps, guint nth); GstCaps * gst_caps_copy_nth (const GstCaps *caps, guint nth);
void gst_caps_truncate (GstCaps * caps); void gst_caps_truncate (GstCaps *caps);
void gst_caps_set_simple (GstCaps *caps, void gst_caps_set_simple (GstCaps *caps,
char *field, ...) G_GNUC_NULL_TERMINATED; char *field, ...) G_GNUC_NULL_TERMINATED;
void gst_caps_set_simple_valist (GstCaps *caps, void gst_caps_set_simple_valist (GstCaps *caps,
@ -222,8 +222,8 @@ gboolean gst_caps_is_subset (const GstCaps *subset,
const GstCaps *superset); const GstCaps *superset);
gboolean gst_caps_is_equal (const GstCaps *caps1, gboolean gst_caps_is_equal (const GstCaps *caps1,
const GstCaps *caps2); const GstCaps *caps2);
gboolean gst_caps_is_equal_fixed (const GstCaps * caps1, gboolean gst_caps_is_equal_fixed (const GstCaps *caps1,
const GstCaps * caps2); const GstCaps *caps2);
/* operations */ /* operations */

View file

@ -79,7 +79,7 @@ GST_START_TEST (create_queries)
GstFormat format; GstFormat format;
gint64 start, stop; gint64 start, stop;
format = GST_FORMAT_TIME; format = GST_FORMAT_BYTES;
query = gst_query_new_segment (format); query = gst_query_new_segment (format);
fail_if (query == NULL); fail_if (query == NULL);
@ -88,10 +88,24 @@ GST_START_TEST (create_queries)
gst_query_parse_segment (query, &rate, &format, &start, &stop); gst_query_parse_segment (query, &rate, &format, &start, &stop);
/* see if empty gives undefined formats */ /* see if empty gives undefined formats */
fail_if (rate == 1.0); fail_if (rate != 0.0);
fail_if (format != GST_FORMAT_TIME); fail_if (format != GST_FORMAT_BYTES);
fail_if (start != -1); fail_if (start != -1);
fail_if (stop != -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 */ /* FORMATS */