} G_STMT_END
-static void _gst_caps_transform_to_string (const GValue *src_value,
- GValue *dest_value);
-static gboolean _gst_caps_from_string_inplace (GstCaps *caps,
- const gchar *string);
-static GstCaps * gst_caps_copy_conditional (const GstCaps *src);
-
-
-GType _gst_caps_type;
-
-void _gst_caps_initialize (void)
+static void gst_caps_transform_to_string (const GValue *src_value,
+ GValue *dest_value);
+static gboolean gst_caps_from_string_inplace (GstCaps *caps,
+ const gchar *string);
+static GstCaps * gst_caps_copy_conditional (const GstCaps *src);
+
+GType
+gst_caps_get_type (void)
{
- _gst_caps_type = g_boxed_type_register_static ("GstCaps",
- (GBoxedCopyFunc)gst_caps_copy_conditional,
- (GBoxedFreeFunc)gst_caps_free);
-
- g_value_register_transform_func (_gst_caps_type, G_TYPE_STRING,
- _gst_caps_transform_to_string);
-}
-
-GType gst_caps_get_type (void)
-{
- return _gst_caps_type;
+ static Gtype gst_caps_type = 0;
+
+ if (!gst_caps_type) {
+ gst_caps_type = g_boxed_type_register_static ("GstCaps",
+ (GBoxedCopyFunc)gst_caps_copy_conditional,
+ (GBoxedFreeFunc)gst_caps_free);
+
+ g_value_register_transform_func (gst_caps_type,
+ G_TYPE_STRING,
+ gst_caps_transform_to_string);
+ }
+
+ return gst_caps_type;
}
/* creation/deletion */
*
* Returns: the new #GstCaps
*/
-GstCaps *gst_caps_new_empty (void)
+GstCaps *
+gst_caps_new_empty (void)
{
GstCaps *caps = g_new0(GstCaps, 1);
- caps->type = _gst_caps_type;
+ caps->type = GST_TYPE_CAPS;
caps->structs = g_ptr_array_new();
return caps;
*
* Returns: the new #GstCaps
*/
-GstCaps *gst_caps_new_any (void)
+GstCaps *
+gst_caps_new_any (void)
{
GstCaps *caps = g_new0(GstCaps, 1);
- caps->type = _gst_caps_type;
+ caps->type = GST_TYPE_CAPS;
caps->structs = g_ptr_array_new();
caps->flags = GST_CAPS_FLAGS_ANY;
*
* Returns: the new #GstCaps
*/
-GstCaps *gst_caps_new_simple (const char *media_type, const char *fieldname,
- ...)
+GstCaps *
+gst_caps_new_simple (const char *media_type,
+ const char *fieldname,
+ ...)
{
GstCaps *caps;
GstStructure *structure;
va_list var_args;
caps = g_new0(GstCaps, 1);
- caps->type = _gst_caps_type;
+ caps->type = GST_TYPE_CAPS;
caps->structs = g_ptr_array_new();
va_start (var_args, fieldname);
*
* Returns: the new #GstCaps
*/
-GstCaps *gst_caps_new_full (GstStructure *struct1, ...)
+GstCaps *
+gst_caps_new_full (GstStructure *struct1, ...)
{
GstCaps *caps;
va_list var_args;
*
* Returns: the new #GstCaps
*/
-GstCaps *gst_caps_new_full_valist (GstStructure *structure,
- va_list var_args)
+GstCaps *
+gst_caps_new_full_valist (GstStructure *structure,
+ va_list var_args)
{
GstCaps *caps;
caps = g_new0(GstCaps, 1);
- caps->type = _gst_caps_type;
+ caps->type = GST_TYPE_CAPS;
caps->structs = g_ptr_array_new();
while(structure){
*
* Returns: the new #GstCaps
*/
-GstCaps *gst_caps_copy (const GstCaps *caps)
+GstCaps *
+gst_caps_copy (const GstCaps *caps)
{
GstCaps *newcaps;
GstStructure *structure;
g_return_val_if_fail(caps != NULL, NULL);
newcaps = g_new0(GstCaps, 1);
- newcaps->type = _gst_caps_type;
+ newcaps->type = GST_TYPE_CAPS;
newcaps->flags = caps->flags;
newcaps->structs = g_ptr_array_new();
* Frees a #GstCaps and all its structures and the structures'
* values.
*/
-void gst_caps_free (GstCaps *caps)
+void
+gst_caps_free (GstCaps *caps)
{
GstStructure *structure;
int i;
*
* Returns: the new #GstCaps
*/
-const GstCaps *gst_static_caps_get (GstStaticCaps *static_caps)
+const GstCaps *
+gst_static_caps_get (GstStaticCaps *static_caps)
{
GstCaps *caps = (GstCaps *)static_caps;
gboolean ret;
if (caps->type == 0) {
- caps->type = _gst_caps_type;
+ caps->type = GST_TYPE_CAPS;
caps->structs = g_ptr_array_new();
- ret = _gst_caps_from_string_inplace (caps, static_caps->string);
+ ret = gst_caps_from_string_inplace (caps, static_caps->string);
if (!ret) {
g_critical ("Could not convert static caps \"%s\"", static_caps->string);
* in @caps2 are not copied -- they are transferred to @caps1, and then
* @caps2 is freed.
*/
-void gst_caps_append (GstCaps *caps1, GstCaps *caps2)
+void
+gst_caps_append (GstCaps *caps1,
+ GstCaps *caps2)
{
GstStructure *structure;
int i;
* Appends @structure to @caps1. The structure is not copied; @caps1
* becomes the owner of @structure.
*/
-void gst_caps_append_structure (GstCaps *caps, GstStructure *structure)
+void
+gst_caps_append_structure (GstCaps *caps,
+ GstStructure *structure)
{
g_return_if_fail(caps != NULL);
*
* Returns:
*/
-GstCaps *gst_caps_split_one (GstCaps *caps)
+GstCaps *
+gst_caps_split_one (GstCaps *caps)
{
/* FIXME */
g_critical ("unimplemented");
*
* Returns: the number of structures that @caps contains
*/
-int gst_caps_get_size (const GstCaps *caps)
+int
+gst_caps_get_size (const GstCaps *caps)
{
g_return_val_if_fail (caps != NULL, 0);
*
* Returns: a pointer to the #GstStructure corresponding to @index
*/
-GstStructure *gst_caps_get_structure (const GstCaps *caps, int index)
+GstStructure *
+gst_caps_get_structure (const GstCaps *caps, int index)
{
g_return_val_if_fail (caps != NULL, NULL);
g_return_val_if_fail (index >= 0, NULL);
*
* Returns: the new @GstCaps
*/
-GstCaps *gst_caps_copy_1 (const GstCaps *caps)
+GstCaps *
+gst_caps_copy_1 (const GstCaps *caps)
{
GstCaps *newcaps;
GstStructure *structure;
g_return_val_if_fail(caps != NULL, NULL);
newcaps = g_new0(GstCaps, 1);
- newcaps->type = _gst_caps_type;
+ newcaps->type = GST_TYPE_CAPS;
newcaps->flags = caps->flags;
newcaps->structs = g_ptr_array_new();
* only has one structure. The arguments must be passed in the same
* manner as @gst_structure_set(), and be NULL-terminated.
*/
-void gst_caps_set_simple (GstCaps *caps, char *field, ...)
+void
+gst_caps_set_simple (GstCaps *caps, char *field, ...)
{
GstStructure *structure;
va_list var_args;
* only has one structure. The arguments must be passed in the same
* manner as @gst_structure_set(), and be NULL-terminated.
*/
-void gst_caps_set_simple_valist (GstCaps *caps, char *field, va_list varargs)
+void
+gst_caps_set_simple_valist (GstCaps *caps,
+ char *field,
+ va_list varargs)
{
GstStructure *structure;
*
* Returns: TRUE if @caps represents any format.
*/
-gboolean gst_caps_is_any (const GstCaps *caps)
+gboolean
+gst_caps_is_any (const GstCaps *caps)
{
g_return_val_if_fail(caps != NULL, FALSE);
*
* Returns: TRUE if @caps represents no formats.
*/
-gboolean gst_caps_is_empty (const GstCaps *caps)
+gboolean
+gst_caps_is_empty (const GstCaps *caps)
{
g_return_val_if_fail(caps != NULL, FALSE);
*
* Returns: TRUE if @caps contains more than one structure
*/
-gboolean gst_caps_is_chained (const GstCaps *caps)
+gboolean
+gst_caps_is_chained (const GstCaps *caps)
{
g_return_val_if_fail(caps != NULL, FALSE);
}
static gboolean
-_gst_caps_is_fixed_foreach (GQuark field_id, GValue *value, gpointer unused)
+gst_caps_is_fixed_foreach (GQuark field_id,
+ GValue *value,
+ gpointer unused)
{
GType type = G_VALUE_TYPE (value);
if (G_TYPE_IS_FUNDAMENTAL (type)) return TRUE;
*
* Returns: TRUE if @caps is fixed
*/
-gboolean gst_caps_is_fixed (const GstCaps *caps)
+gboolean
+gst_caps_is_fixed (const GstCaps *caps)
{
GstStructure *structure;
structure = gst_caps_get_structure (caps, 0);
- return gst_structure_foreach (structure, _gst_caps_is_fixed_foreach, NULL);
+ return gst_structure_foreach (structure, gst_caps_is_fixed_foreach, NULL);
}
static gboolean
-_gst_structure_is_equal_foreach (GQuark field_id,
- GValue *val2, gpointer data)
+gst_structure_is_equal_foreach (GQuark field_id,
+ GValue *val2,
+ gpointer data)
{
GstStructure *struct1 = (GstStructure *) data;
const GValue *val1 = gst_structure_id_get_value (struct1, field_id);
*
* Returns: TRUE if the arguments represent the same format
*/
-gboolean gst_caps_is_equal_fixed (const GstCaps *caps1, const GstCaps *caps2)
+gboolean
+gst_caps_is_equal_fixed (const GstCaps *caps1, const GstCaps *caps2)
{
GstStructure *struct1, *struct2;
return FALSE;
}
- return gst_structure_foreach (struct1, _gst_structure_is_equal_foreach,
- struct2);
+ return gst_structure_foreach (struct1, gst_structure_is_equal_foreach,
+ struct2);
}
static gboolean
-_gst_structure_field_has_compatible (GQuark field_id,
- GValue *val2, gpointer data)
+gst_structure_field_has_compatible (GQuark field_id,
+ GValue *val2,
+ gpointer data)
{
GValue dest = { 0 };
GstStructure *struct1 = (GstStructure *) data;
}
static gboolean
-_gst_cap_is_always_compatible (const GstStructure *struct1,
- const GstStructure *struct2)
+gst_cap_is_always_compatible (const GstStructure *struct1,
+ const GstStructure *struct2)
{
if(struct1->name != struct2->name){
return FALSE;
/* the reversed order is important */
return gst_structure_foreach ((GstStructure *) struct2,
- _gst_structure_field_has_compatible, (gpointer) struct1);
+ gst_structure_field_has_compatible, (gpointer) struct1);
}
static gboolean
-_gst_caps_cap_is_always_compatible (const GstStructure *struct1,
- const GstCaps *caps2)
+gst_caps_cap_is_always_compatible (const GstStructure *struct1,
+ const GstCaps *caps2)
{
int i;
for(i=0;i<caps2->structs->len;i++){
GstStructure *struct2 = gst_caps_get_structure (caps2, i);
- if (_gst_cap_is_always_compatible (struct1, struct2)) {
+ if (gst_cap_is_always_compatible (struct1, struct2)) {
return TRUE;
}
}
for(i=0;i<caps1->structs->len;i++) {
GstStructure *struct1 = gst_caps_get_structure (caps1, i);
- if (_gst_caps_cap_is_always_compatible(struct1, caps2) == FALSE){
+ if (gst_caps_cap_is_always_compatible(struct1, caps2) == FALSE){
return FALSE;
}
return TRUE;
}
-static GstStructure *gst_caps_structure_intersect (const GstStructure *struct1,
- const GstStructure *struct2)
+static GstStructure *
+gst_caps_structure_intersect (const GstStructure *struct1,
+ const GstStructure *struct2)
{
IntersectData data;
}
#if 0
-static GstStructure *gst_caps_structure_union (const GstStructure *struct1,
- const GstStructure *struct2)
+static GstStructure *
+gst_caps_structure_union (const GstStructure *struct1,
+ const GstStructure *struct2)
{
int i;
GstStructure *dest;
*
* Returns: the new #GstCaps
*/
-GstCaps *gst_caps_intersect (const GstCaps *caps1, const GstCaps *caps2)
+GstCaps *
+gst_caps_intersect (const GstCaps *caps1,
+ const GstCaps *caps2)
{
int i,j;
GstStructure *struct1;
*
* Returns: the new #GstCaps
*/
-GstCaps *gst_caps_union (const GstCaps *caps1, const GstCaps *caps2)
+GstCaps *
+gst_caps_union (const GstCaps *caps1,
+ const GstCaps *caps2)
{
GstCaps *dest1;
GstCaps *dest2;
} NormalizeForeach;
static gboolean
-_gst_caps_normalize_foreach (GQuark field_id, GValue *value, gpointer ptr)
+gst_caps_normalize_foreach (GQuark field_id,
+ GValue *value,
+ gpointer ptr)
{
NormalizeForeach *nf = (NormalizeForeach *) ptr;
GValue val = { 0 };
*
* Returns: the new #GstCaps
*/
-GstCaps *gst_caps_normalize (const GstCaps *caps)
+GstCaps *
+gst_caps_normalize (const GstCaps *caps)
{
NormalizeForeach nf;
GstCaps *newcaps;
for(i=0;i<newcaps->structs->len;i++){
nf.structure = gst_caps_get_structure (newcaps, i);
- while (!gst_structure_foreach (nf.structure, _gst_caps_normalize_foreach,
- &nf));
+ while (!gst_structure_foreach (nf.structure,
+ gst_caps_normalize_foreach,
+ &nf));
}
return newcaps;
}
static gboolean
-simplify_foreach (GQuark field_id, GValue *value, gpointer user_data)
+simplify_foreach (GQuark field_id,
+ GValue *value,
+ gpointer user_data)
{
GstStructure *s2 = (GstStructure *) user_data;
const GValue *v2;
}
static gboolean
-gst_caps_structure_simplify (GstStructure *struct1, const GstStructure *struct2)
+gst_caps_structure_simplify (GstStructure *struct1,
+ const GstStructure *struct2)
{
/* FIXME this is just a simple compare. Better would be to merge
* the two structures */
*
* Returns: the new #GstCaps
*/
-GstCaps *gst_caps_simplify (const GstCaps *caps)
+GstCaps *
+gst_caps_simplify (const GstCaps *caps)
{
int i;
int j;
}
#ifndef GST_DISABLE_LOADSAVE
-xmlNodePtr gst_caps_save_thyself (const GstCaps *caps, xmlNodePtr parent)
+xmlNodePtr
+gst_caps_save_thyself (const GstCaps *caps, xmlNodePtr parent)
{
return 0;
}
-GstCaps *gst_caps_load_thyself (xmlNodePtr parent)
+GstCaps *
+gst_caps_load_thyself (xmlNodePtr parent)
{
return NULL;
* pointed to by @caps, if applicable, then modifies @caps to point to
* @newcaps.
*/
-void gst_caps_replace (GstCaps **caps, GstCaps *newcaps)
+void
+gst_caps_replace (GstCaps **caps,
+ GstCaps *newcaps)
{
#if 0 /* disable this, since too many plugins rely on undefined behavior */
#ifdef USE_POISONING
*
* Returns: a string representing @caps
*/
-gchar *gst_caps_to_string (const GstCaps *caps)
+gchar *
+gst_caps_to_string (const GstCaps *caps)
{
int i;
GstStructure *structure;
return g_string_free(s, FALSE);
}
-static gboolean _gst_caps_from_string_inplace (GstCaps *caps,
- const gchar *string)
+static gboolean
+gst_caps_from_string_inplace (GstCaps *caps,
+ const gchar *string)
{
GstStructure *structure;
gchar *s;
*
* Returns: a new #GstCaps
*/
-GstCaps *gst_caps_from_string (const gchar *string)
+GstCaps *
+gst_caps_from_string (const gchar *string)
{
GstCaps *caps;
caps = gst_caps_new_empty();
- if (_gst_caps_from_string_inplace (caps, string)) {
+ if (gst_caps_from_string_inplace (caps, string)) {
return caps;
} else {
gst_caps_free (caps);
}
}
-static void _gst_caps_transform_to_string (const GValue *src_value,
- GValue *dest_value)
+static void
+gst_caps_transform_to_string (const GValue *src_value,
+ GValue *dest_value)
{
g_return_if_fail (src_value != NULL);
g_return_if_fail (dest_value != NULL);
gst_caps_to_string (src_value->data[0].v_pointer);
}
-static GstCaps * gst_caps_copy_conditional (const GstCaps *src)
+static GstCaps *
+gst_caps_copy_conditional (const GstCaps *src)
{
if (src) {
return gst_caps_copy (src);
/* fixate utility functions */
-gboolean gst_caps_structure_fixate_field_nearest_int (GstStructure *structure,
- const char *field_name, int target)
+gboolean
+gst_caps_structure_fixate_field_nearest_int (GstStructure *structure,
+ const char *field_name,
+ int target)
{
const GValue *value;
return FALSE;
}
-gboolean gst_caps_structure_fixate_field_nearest_double (GstStructure
- *structure, const char *field_name, double target)
+gboolean
+gst_caps_structure_fixate_field_nearest_double (GstStructure *structure,
+ const char *field_name,
+ double target)
{
const GValue *value;