element: use quarks when storing standard metadata in structures

This commit is contained in:
Tim-Philipp Müller 2012-04-09 13:40:35 +01:00
parent a63829b4ff
commit 4f1df6d094
3 changed files with 20 additions and 11 deletions

View file

@ -92,6 +92,7 @@
#include "gstevent.h"
#include "gstutils.h"
#include "gstinfo.h"
#include "gstquark.h"
#include "gstvalue.h"
#include "gst-i18n-lib.h"
#include "glib-compat-private.h"
@ -1279,11 +1280,11 @@ gst_element_class_set_metadata (GstElementClass * klass,
{
g_return_if_fail (GST_IS_ELEMENT_CLASS (klass));
gst_structure_set ((GstStructure *) klass->metadata,
GST_ELEMENT_METADATA_LONGNAME, G_TYPE_STRING, longname,
GST_ELEMENT_METADATA_KLASS, G_TYPE_STRING, classification,
GST_ELEMENT_METADATA_DESCRIPTION, G_TYPE_STRING, description,
GST_ELEMENT_METADATA_AUTHOR, G_TYPE_STRING, author, NULL);
gst_structure_id_set ((GstStructure *) klass->metadata,
GST_QUARK (ELEMENT_METADATA_LONGNAME), G_TYPE_STRING, longname,
GST_QUARK (ELEMENT_METADATA_KLASS), G_TYPE_STRING, classification,
GST_QUARK (ELEMENT_METADATA_DESCRIPTION), G_TYPE_STRING, description,
GST_QUARK (ELEMENT_METADATA_AUTHOR), G_TYPE_STRING, author, NULL);
}
/**
@ -1319,16 +1320,17 @@ gst_element_class_set_static_metadata (GstElementClass * klass,
g_value_init (&val, G_TYPE_STRING);
g_value_set_static_string (&val, longname);
gst_structure_set_value (s, GST_ELEMENT_METADATA_LONGNAME, &val);
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_LONGNAME), &val);
g_value_set_static_string (&val, classification);
gst_structure_set_value (s, GST_ELEMENT_METADATA_KLASS, &val);
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_KLASS), &val);
g_value_set_static_string (&val, description);
gst_structure_set_value (s, GST_ELEMENT_METADATA_DESCRIPTION, &val);
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_DESCRIPTION),
&val);
g_value_set_static_string (&val, author);
gst_structure_take_value (s, GST_ELEMENT_METADATA_AUTHOR, &val);
gst_structure_id_take_value (s, GST_QUARK (ELEMENT_METADATA_AUTHOR), &val);
}
/**

View file

@ -22,6 +22,7 @@
#include "gst_private.h"
#include "gstquark.h"
#include "gstelementmetadata.h"
/* These strings must match order and number declared in the GstQuarkId
* enum in gstquark.h! */
@ -57,7 +58,9 @@ static const gchar *_quark_strings[] = {
"allocator", "GstEventFlushStop", "options", "GstQueryAcceptCaps",
"result", "GstQueryCaps", "filter", "modes", "GstEventStreamConfig",
"setup-data", "stream-headers", "GstEventGap", "GstQueryDrain", "params",
"toc-select", "uid", "toc"
"toc-select", "uid", "toc", GST_ELEMENT_METADATA_LONGNAME,
GST_ELEMENT_METADATA_KLASS, GST_ELEMENT_METADATA_DESCRIPTION,
GST_ELEMENT_METADATA_AUTHOR
};
GQuark _priv_gst_quark_table[GST_QUARK_MAX];

View file

@ -167,7 +167,11 @@ typedef enum _GstQuarkId
GST_QUARK_EVENT_TOC_SELECT = 138,
GST_QUARK_UID = 139,
GST_QUARK_QUERY_TOC = 140,
GST_QUARK_MAX = 141
GST_QUARK_ELEMENT_METADATA_LONGNAME = 141,
GST_QUARK_ELEMENT_METADATA_KLASS = 142,
GST_QUARK_ELEMENT_METADATA_DESCRIPTION = 143,
GST_QUARK_ELEMENT_METADATA_AUTHOR = 144,
GST_QUARK_MAX = 145
} GstQuarkId;
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];