taglist: make opaque

Hide the fact that it's just a GstStructure from the API. We
may want to change this in future (e.g. to add refcounting).
Also, it caused problems for bindings (though that's mostly
the way we typedefed it to GstStructure).
This commit is contained in:
Tim-Philipp Müller 2011-10-30 10:05:23 +00:00
parent 3a4f580bb2
commit dc7ec44486
2 changed files with 15 additions and 19 deletions

View file

@ -42,12 +42,20 @@
#include "gstvalue.h"
#include "gstbuffer.h"
#include "gstquark.h"
#include "gststructure.h"
#include <gobject/gvaluecollector.h>
#include <string.h>
#define GST_TAG_IS_VALID(tag) (gst_tag_get_info (tag) != NULL)
/* FIXME 0.11: make taglists refcounted maybe? */
/* a tag list is basically a structure, but we don't make this fact public */
struct _GstTagList
{
GstStructure structure;
};
/* FIXME 0.11: use GParamSpecs or something similar for tag registrations,
* possibly even gst_tag_register(). Especially value ranges might be
* useful for some tags. */
@ -845,15 +853,16 @@ gst_is_tag_list (gconstpointer p)
typedef struct
{
GstStructure *list;
GstTagList *list;
GstTagMergeMode mode;
}
GstTagCopyData;
static void
gst_tag_list_add_value_internal (GstStructure * list, GstTagMergeMode mode,
gst_tag_list_add_value_internal (GstTagList * tag_list, GstTagMergeMode mode,
const gchar * tag, const GValue * value, GstTagInfo * info)
{
GstStructure *list = GST_STRUCTURE (tag_list);
const GValue *value2;
GQuark tag_quark;
@ -945,10 +954,10 @@ gst_tag_list_insert (GstTagList * into, const GstTagList * from,
g_return_if_fail (GST_IS_TAG_LIST (from));
g_return_if_fail (GST_TAG_MODE_IS_VALID (mode));
data.list = (GstStructure *) into;
data.list = into;
data.mode = mode;
if (mode == GST_TAG_MERGE_REPLACE_ALL) {
gst_structure_remove_all_fields (data.list);
gst_structure_remove_all_fields (GST_STRUCTURE (data.list));
}
gst_structure_foreach ((GstStructure *) from, gst_tag_list_copy_foreach,
&data);
@ -1120,7 +1129,7 @@ gst_tag_list_add_valist (GstTagList * list, GstTagMergeMode mode,
g_return_if_fail (tag != NULL);
if (mode == GST_TAG_MERGE_REPLACE_ALL) {
gst_structure_remove_all_fields (list);
gst_structure_remove_all_fields (GST_STRUCTURE (list));
}
while (tag != NULL) {
@ -1164,7 +1173,7 @@ gst_tag_list_add_valist_values (GstTagList * list, GstTagMergeMode mode,
g_return_if_fail (tag != NULL);
if (mode == GST_TAG_MERGE_REPLACE_ALL) {
gst_structure_remove_all_fields (list);
gst_structure_remove_all_fields (GST_STRUCTURE (list));
}
while (tag != NULL) {

View file

@ -25,7 +25,6 @@
#include <gst/gstdatetime.h>
#include <gst/gstbuffer.h>
#include <gst/gststructure.h>
#include <gst/glib-compat.h>
G_BEGIN_DECLS
@ -142,24 +141,12 @@ typedef enum {
#define GST_TAG_FLAG_IS_VALID(flag) (((flag) > GST_TAG_FLAG_UNDEFINED) && ((flag) < GST_TAG_FLAG_COUNT))
/* FIXME 0.11: Don't typedef GstTagList to be a GstStructure, they're
* internally the same but not from an API point of view.
* See bug #518934.
*/
/**
* GstTagList:
*
* Opaque #GstTagList data structure.
*/
#ifdef _FOOL_GTK_DOC_
typedef struct _GstTagList GstTagList;
#else
#ifdef IN_GOBJECT_INTROSPECTION
typedef struct _GstTagList GstTagList;
#else
typedef GstStructure GstTagList;
#endif
#endif
#define GST_TAG_LIST(x) ((GstTagList *) (x))
#define GST_IS_TAG_LIST(x) ((x) != NULL && gst_is_tag_list (GST_TAG_LIST (x)))