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

@ -176,75 +176,75 @@ GType gst_caps_get_type (void);
GstCaps * gst_caps_new_empty (void);
GstCaps * gst_caps_new_any (void);
GstCaps * gst_caps_new_simple (const char *media_type,
const char *fieldname,
...);
const char *fieldname,
...);
GstCaps * gst_caps_new_full (GstStructure *struct1, ...);
GstCaps * gst_caps_new_full_valist (GstStructure *structure,
va_list var_args);
va_list var_args);
/* reference counting */
GstCaps * gst_caps_ref (GstCaps* caps);
GstCaps * gst_caps_copy (const GstCaps * caps);
GstCaps * gst_caps_make_writable (GstCaps *caps);
void gst_caps_unref (GstCaps* caps);
GstCaps * gst_caps_ref (GstCaps *caps);
GstCaps * gst_caps_copy (const GstCaps *caps);
GstCaps * gst_caps_make_writable (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);
/* manipulation */
void gst_caps_append (GstCaps *caps1,
GstCaps *caps2);
GstCaps *caps2);
void gst_caps_merge (GstCaps *caps1,
GstCaps *caps2);
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);
GstStructure *structure);
void gst_caps_remove_structure (GstCaps *caps, guint idx);
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);
GstCaps * gst_caps_copy_nth (const GstCaps * caps, guint nth);
void gst_caps_truncate (GstCaps * caps);
guint index);
GstCaps * gst_caps_copy_nth (const GstCaps *caps, guint nth);
void gst_caps_truncate (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,
char *field,
va_list varargs);
char *field,
va_list varargs);
/* tests */
gboolean gst_caps_is_any (const GstCaps *caps);
gboolean gst_caps_is_empty (const GstCaps *caps);
gboolean gst_caps_is_fixed (const GstCaps *caps);
gboolean gst_caps_is_always_compatible (const GstCaps *caps1,
const GstCaps *caps2);
gboolean gst_caps_is_subset (const GstCaps *subset,
const GstCaps *superset);
gboolean gst_caps_is_equal (const GstCaps *caps1,
const GstCaps *caps2);
gboolean gst_caps_is_equal_fixed (const GstCaps * caps1,
const GstCaps * caps2);
const GstCaps *caps2);
gboolean gst_caps_is_subset (const GstCaps *subset,
const GstCaps *superset);
gboolean gst_caps_is_equal (const GstCaps *caps1,
const GstCaps *caps2);
gboolean gst_caps_is_equal_fixed (const GstCaps *caps1,
const GstCaps *caps2);
/* operations */
GstCaps * gst_caps_intersect (const GstCaps *caps1,
const GstCaps *caps2);
GstCaps * gst_caps_subtract (const GstCaps *minuend,
const GstCaps *subtrahend);
const GstCaps *caps2);
GstCaps * gst_caps_subtract (const GstCaps *minuend,
const GstCaps *subtrahend);
GstCaps * gst_caps_union (const GstCaps *caps1,
const GstCaps *caps2);
const GstCaps *caps2);
GstCaps * gst_caps_normalize (const GstCaps *caps);
gboolean gst_caps_do_simplify (GstCaps *caps);
gboolean gst_caps_do_simplify (GstCaps *caps);
#ifndef GST_DISABLE_LOADSAVE
xmlNodePtr gst_caps_save_thyself (const GstCaps *caps,
xmlNodePtr parent);
xmlNodePtr parent);
GstCaps * gst_caps_load_thyself (xmlNodePtr parent);
#endif
/* utility */
void gst_caps_replace (GstCaps **caps,
GstCaps *newcaps);
GstCaps *newcaps);
gchar * gst_caps_to_string (const GstCaps *caps);
GstCaps * gst_caps_from_string (const gchar *string);

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 */