mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-15 22:01:27 +00:00
Change structure_field_foreach() look more like glib functions.
Original commit message from CVS: Change structure_field_foreach() look more like glib functions.
This commit is contained in:
parent
23492ddb4e
commit
011c7b3a96
4 changed files with 26 additions and 18 deletions
|
@ -28,13 +28,6 @@
|
|||
#include <gst/gst.h>
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
//#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,
|
||||
|
@ -660,7 +653,7 @@ gst_structure_field_foreach (GstStructure *structure,
|
|||
for(i=0;i<structure->fields->len;i++){
|
||||
field = GST_STRUCTURE_FIELD(structure, i);
|
||||
|
||||
ret = func (structure, field->name, &field->value, user_data);
|
||||
ret = func (field->name, &field->value, user_data);
|
||||
if (!ret) return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,11 @@ typedef struct _GstStructureField GstStructureField;
|
|||
typedef gboolean (*GstStructureForeachFunc) (GQuark field_id, GValue *value,
|
||||
gpointer user_data);
|
||||
|
||||
struct _GstStructureField {
|
||||
GQuark name;
|
||||
GValue value;
|
||||
};
|
||||
|
||||
struct _GstStructure {
|
||||
GType type;
|
||||
int len;
|
||||
|
|
15
gst/gsttag.c
15
gst/gsttag.c
|
@ -438,12 +438,14 @@ gst_tag_list_add_value_internal (GstStructure *list, GstTagMergeMode mode, GQuar
|
|||
}
|
||||
}
|
||||
}
|
||||
static void
|
||||
gst_tag_list_copy_foreach (GstStructure *structure, GQuark tag, GValue *value, gpointer user_data)
|
||||
static int
|
||||
gst_tag_list_copy_foreach (GQuark tag, GValue *value, gpointer user_data)
|
||||
{
|
||||
GstTagCopyData *copy = (GstTagCopyData *) user_data;
|
||||
|
||||
gst_tag_list_add_value_internal (copy->list, copy->mode, tag, value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
/**
|
||||
* gst_tag_list_insert:
|
||||
|
@ -631,14 +633,16 @@ gst_tag_list_remove_tag (GstTagList *list, const gchar *tag)
|
|||
}
|
||||
typedef struct {
|
||||
GstTagForeachFunc func;
|
||||
GstTagList * tag_list;
|
||||
gpointer data;
|
||||
} TagForeachData;
|
||||
static void
|
||||
structure_foreach_wrapper (GstStructure *structure, GQuark field_id,
|
||||
static int
|
||||
structure_foreach_wrapper (GQuark field_id,
|
||||
GValue *value, gpointer user_data)
|
||||
{
|
||||
TagForeachData *data = (TagForeachData *) user_data;
|
||||
data->func (GST_TAG_LIST (structure), g_quark_to_string (field_id), data->data);
|
||||
data->func (data->tag_list, g_quark_to_string (field_id), data->data);
|
||||
return TRUE;
|
||||
}
|
||||
/**
|
||||
* gst_tag_list_foreach:
|
||||
|
@ -658,6 +662,7 @@ gst_tag_list_foreach (GstTagList *list, GstTagForeachFunc func, gpointer user_da
|
|||
g_return_if_fail (func != NULL);
|
||||
|
||||
data.func = func;
|
||||
data.tag_list = list;
|
||||
data.data = user_data;
|
||||
gst_structure_field_foreach ((GstStructure *) list, structure_foreach_wrapper, &data);
|
||||
}
|
||||
|
|
|
@ -438,12 +438,14 @@ gst_tag_list_add_value_internal (GstStructure *list, GstTagMergeMode mode, GQuar
|
|||
}
|
||||
}
|
||||
}
|
||||
static void
|
||||
gst_tag_list_copy_foreach (GstStructure *structure, GQuark tag, GValue *value, gpointer user_data)
|
||||
static int
|
||||
gst_tag_list_copy_foreach (GQuark tag, GValue *value, gpointer user_data)
|
||||
{
|
||||
GstTagCopyData *copy = (GstTagCopyData *) user_data;
|
||||
|
||||
gst_tag_list_add_value_internal (copy->list, copy->mode, tag, value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
/**
|
||||
* gst_tag_list_insert:
|
||||
|
@ -631,14 +633,16 @@ gst_tag_list_remove_tag (GstTagList *list, const gchar *tag)
|
|||
}
|
||||
typedef struct {
|
||||
GstTagForeachFunc func;
|
||||
GstTagList * tag_list;
|
||||
gpointer data;
|
||||
} TagForeachData;
|
||||
static void
|
||||
structure_foreach_wrapper (GstStructure *structure, GQuark field_id,
|
||||
static int
|
||||
structure_foreach_wrapper (GQuark field_id,
|
||||
GValue *value, gpointer user_data)
|
||||
{
|
||||
TagForeachData *data = (TagForeachData *) user_data;
|
||||
data->func (GST_TAG_LIST (structure), g_quark_to_string (field_id), data->data);
|
||||
data->func (data->tag_list, g_quark_to_string (field_id), data->data);
|
||||
return TRUE;
|
||||
}
|
||||
/**
|
||||
* gst_tag_list_foreach:
|
||||
|
@ -658,6 +662,7 @@ gst_tag_list_foreach (GstTagList *list, GstTagForeachFunc func, gpointer user_da
|
|||
g_return_if_fail (func != NULL);
|
||||
|
||||
data.func = func;
|
||||
data.tag_list = list;
|
||||
data.data = user_data;
|
||||
gst_structure_field_foreach ((GstStructure *) list, structure_foreach_wrapper, &data);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue