Start to remove GstStructureField from exported API

Original commit message from CVS:
Start to remove GstStructureField from exported API
This commit is contained in:
David Schleef 2003-12-10 21:14:12 +00:00
parent 7714e7f75f
commit 23492ddb4e
3 changed files with 27 additions and 18 deletions

View file

@ -30,6 +30,11 @@
//#define G_TYPE_FOURCC G_TYPE_FLOAT
struct _GstStructureField {
GQuark name;
GValue value;
};
static GType _gst_structure_type;
static void _gst_structure_transform_to_string(const GValue *src_value,
@ -650,11 +655,13 @@ gst_structure_field_foreach (GstStructure *structure,
{
int i;
GstStructureField *field;
gboolean ret;
for(i=0;i<structure->fields->len;i++){
field = GST_STRUCTURE_FIELD(structure, i);
func (structure, field->name, &field->value, user_data);
ret = func (structure, field->name, &field->value, user_data);
if (!ret) return;
}
}

View file

@ -28,8 +28,8 @@ G_BEGIN_DECLS
typedef struct _GstStructure GstStructure;
typedef struct _GstStructureField GstStructureField;
typedef void (*GstStructureForeachFunc) (GstStructure *structure,
GQuark field_id, GValue *value, gpointer user_data);
typedef gboolean (*GstStructureForeachFunc) (GQuark field_id, GValue *value,
gpointer user_data);
struct _GstStructure {
GType type;
@ -40,11 +40,6 @@ struct _GstStructure {
GArray *fields;
};
struct _GstStructureField {
GQuark name;
GValue value;
};
#define GST_STRUCTURE_FIELD(structure, index) \
&g_array_index((structure)->fields, GstStructureField, (index))

View file

@ -1384,20 +1384,27 @@ gst_xml_registry_save_props (GstXMLRegistry *xmlregistry, GstProps *props)
#endif
static gboolean
gst_xml_registry_save_structure (GstXMLRegistry *xmlregistry, const GstStructure *structure)
gst_xml_registry_save_structure_field (GQuark field_id, GValue *value,
gpointer user_data)
{
int i;
GstXMLRegistry *xmlregistry = GST_XML_REGISTRY(user_data);
CLASS (xmlregistry)->save_func (xmlregistry, "<field>\n");
PUT_ESCAPED ("name", g_quark_to_string(field_id));
PUT_ESCAPED ("type", G_VALUE_TYPE_NAME(value));
PUT_ESCAPED ("value", g_strdup_value_contents(value));
CLASS (xmlregistry)->save_func (xmlregistry, "</field>\n");
return TRUE;
}
static gboolean
gst_xml_registry_save_structure (GstXMLRegistry *xmlregistry, GstStructure *structure)
{
CLASS (xmlregistry)->save_func (xmlregistry, "<structure>\n");
PUT_ESCAPED ("name", g_quark_to_string(structure->name));
for (i=0;i<structure->fields->len;i++) {
GstStructureField *field = GST_STRUCTURE_FIELD(structure, i);
CLASS (xmlregistry)->save_func (xmlregistry, "<field>\n");
PUT_ESCAPED ("name", g_quark_to_string(field->name));
PUT_ESCAPED ("type", G_VALUE_TYPE_NAME(&field->value));
PUT_ESCAPED ("value", g_strdup_value_contents(&field->value));
CLASS (xmlregistry)->save_func (xmlregistry, "</field>\n");
}
gst_structure_field_foreach (structure,
gst_xml_registry_save_structure_field, xmlregistry);
CLASS (xmlregistry)->save_func (xmlregistry, "</structure>\n");
return TRUE;
}