mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
tocsetter: use G_DEFINE_INTERFACE_* macro
https://bugzilla.gnome.org/show_bug.cgi?id=673641
This commit is contained in:
parent
d784b753d7
commit
49eb73be77
2 changed files with 17 additions and 43 deletions
|
@ -50,51 +50,23 @@
|
||||||
#include <gobject/gvaluecollector.h>
|
#include <gobject/gvaluecollector.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (gst_toc_interface_debug);
|
|
||||||
#define GST_CAT_DEFAULT tag_toc_interface_debug
|
|
||||||
|
|
||||||
static GQuark gst_toc_key;
|
static GQuark gst_toc_key;
|
||||||
|
|
||||||
|
G_DEFINE_INTERFACE_WITH_CODE (GstTocSetter, gst_toc_setter, GST_TYPE_ELEMENT,
|
||||||
|
gst_toc_key = g_quark_from_static_string ("gst-toc-setter-data"););
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_toc_setter_default_init (GstTocSetterInterface * klass)
|
||||||
|
{
|
||||||
|
/* nothing to do here, it's a dummy interface */
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GstToc *toc;
|
GstToc *toc;
|
||||||
GMutex lock;
|
GMutex lock;
|
||||||
} GstTocData;
|
} GstTocData;
|
||||||
|
|
||||||
GType
|
|
||||||
gst_toc_setter_get_type (void)
|
|
||||||
{
|
|
||||||
static volatile gsize toc_setter_type = 0;
|
|
||||||
|
|
||||||
if (g_once_init_enter (&toc_setter_type)) {
|
|
||||||
GType _type;
|
|
||||||
static const GTypeInfo toc_setter_info = {
|
|
||||||
sizeof (GstTocSetterInterface), /* class_size */
|
|
||||||
NULL, /* base_init */
|
|
||||||
NULL, /* base_finalize */
|
|
||||||
NULL,
|
|
||||||
NULL, /* class_finalize */
|
|
||||||
NULL, /* class_data */
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_toc_interface_debug, "GstTocInterface", 0,
|
|
||||||
"interfaces for the TOC");
|
|
||||||
|
|
||||||
_type = g_type_register_static (G_TYPE_INTERFACE, "GstTocSetter",
|
|
||||||
&toc_setter_info, 0);
|
|
||||||
|
|
||||||
g_type_interface_add_prerequisite (_type, GST_TYPE_ELEMENT);
|
|
||||||
|
|
||||||
gst_toc_key = g_quark_from_static_string ("GST_TOC_SETTER");
|
|
||||||
g_once_init_leave (&toc_setter_type, _type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return toc_setter_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_toc_data_free (gpointer p)
|
gst_toc_data_free (gpointer p)
|
||||||
{
|
{
|
||||||
|
@ -345,9 +317,11 @@ gst_toc_setter_add_toc_entry (GstTocSetter * setter, const gchar * parent_uid,
|
||||||
|
|
||||||
copy_entry = gst_toc_entry_copy (entry);
|
copy_entry = gst_toc_entry_copy (entry);
|
||||||
|
|
||||||
if (g_strcmp0 (parent_uid, "0") == 0)
|
if (g_strcmp0 (parent_uid, "0") == 0) {
|
||||||
|
if (data->toc == NULL)
|
||||||
|
data->toc = gst_toc_new ();
|
||||||
data->toc->entries = g_list_append (data->toc->entries, copy_entry);
|
data->toc->entries = g_list_append (data->toc->entries, copy_entry);
|
||||||
else {
|
} else {
|
||||||
parent = gst_toc_find_entry (data->toc, parent_uid);
|
parent = gst_toc_find_entry (data->toc, parent_uid);
|
||||||
|
|
||||||
if (parent != NULL) {
|
if (parent != NULL) {
|
||||||
|
|
Loading…
Reference in a new issue