GST_CAT_INFO (GST_CAT_EVENT, "creating toc select event for UID: %s", uid);
- structure = gst_structure_id_new (GST_QUARK (EVENT_TOC_SELECT),
+ structure = gst_structure_new_id (GST_QUARK (EVENT_TOC_SELECT),
GST_QUARK (UID), G_TYPE_STRING, uid, NULL);
return gst_event_new_custom (GST_EVENT_TOC_SELECT, structure);
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TOC);
g_return_if_fail (toc != NULL);
- *toc = _gst_toc_from_structure (message->structure);
+ *toc = _gst_toc_from_structure (GST_MESSAGE_STRUCTURE (message));
if (updated != NULL)
- *updated = _gst_toc_structure_get_updated (message->structure);
+ *updated = _gst_toc_structure_get_updated (GST_MESSAGE_STRUCTURE (message));
}
gst_query_new_toc (void)
{
GstQuery *query;
+ GstStructure *structure;
- query = gst_query_new (GST_QUERY_TOC, NULL);
+ structure = gst_structure_new_id_empty (GST_QUARK (QUERY_TOC));
+ query = gst_query_new_custom (GST_QUERY_TOC, structure);
return query;
}
gst_query_set_toc (GstQuery * query, GstToc * toc, const gchar * extend_uid)
{
GstStructure *structure;
+ GstStructure *old_structure;
g_return_if_fail (query != NULL);
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_TOC);
g_return_if_fail (structure != NULL);
/* that shouldn't be happen in normal usage */
- if (query->structure != NULL)
- gst_structure_free (query->structure);
+ old_structure = GST_QUERY_STRUCTURE (query);
+ if (old_structure) {
+ gst_structure_set_parent_refcount (old_structure, NULL);
+ gst_structure_free (old_structure);
+ }
if (extend_uid != NULL)
_gst_toc_structure_set_extend_uid (structure, extend_uid);
- query->structure = structure;
- gst_structure_set_parent_refcount (query->structure,
- &(query->mini_object.refcount));
+ gst_structure_set_parent_refcount (structure, &(query->mini_object.refcount));
+ GST_QUERY_STRUCTURE (query) = structure;
}
/**
GstToc *toc;
toc = g_slice_new0 (GstToc);
- toc->tags = gst_tag_list_new ();
- toc->info = gst_structure_id_empty_new (gst_toc_fields[GST_TOC_INFONAME]);
+ toc->tags = gst_tag_list_new_empty ();
+ toc->info = gst_structure_new_id_empty (gst_toc_fields[GST_TOC_INFONAME]);
return toc;
}
entry = g_slice_new0 (GstTocEntry);
entry->uid = g_strdup (uid);
entry->type = type;
- entry->tags = gst_tag_list_new ();
- entry->info = gst_structure_id_empty_new (gst_toc_fields[GST_TOC_INFONAME]);
+ entry->tags = gst_tag_list_new_empty ();
+ entry->info = gst_structure_new_id_empty (gst_toc_fields[GST_TOC_INFONAME]);
return entry;
}
entry = g_slice_new0 (GstTocEntry);
entry->uid = g_strdup (uid);
entry->type = type;
- entry->tags = gst_tag_list_new ();
+ entry->tags = gst_tag_list_new_empty ();
if (pad != NULL && GST_IS_PAD (pad))
entry->pads = g_list_append (entry->pads, gst_object_ref (pad));
GstStructure *ret;
GValue val = { 0 };
- ret = gst_structure_id_empty_new (gst_toc_fields[GST_TOC_TOC]);
+ ret = gst_structure_new_id_empty (gst_toc_fields[GST_TOC_TOC]);
if (tags != NULL) {
g_value_init (&val, GST_TYPE_STRUCTURE);
GValue val = { 0 };
GstStructure *ret;
- ret = gst_structure_id_empty_new (gst_toc_fields[GST_TOC_ENTRY]);
+ ret = gst_structure_new_id_empty (gst_toc_fields[GST_TOC_ENTRY]);
gst_structure_id_set (ret, gst_toc_fields[GST_TOC_TYPE],
GST_TYPE_TOC_ENTRY_TYPE, type, NULL);
}
if (structure == NULL)
- structure = gst_structure_id_empty_new (gst_toc_fields[GST_TOC_TIMENAME]);
+ structure = gst_structure_new_id_empty (gst_toc_fields[GST_TOC_TIMENAME]);
gst_structure_id_set (structure, gst_toc_fields[GST_TOC_TIME_START],
G_TYPE_INT64, start, gst_toc_fields[GST_TOC_TIME_STOP], G_TYPE_INT64,
#define __GST_TOC_H__
#include <gst/gstconfig.h>
+#include <gst/gststructure.h>
#include <gst/gsttaglist.h>
#include <gst/gstformat.h>
/* check TOC event handling */
event = gst_event_new_toc (toc, TRUE);
fail_if (event == NULL);
- fail_if (event->structure == NULL);
fail_unless (event->type == GST_EVENT_TOC);
ASSERT_MINI_OBJECT_REFCOUNT (GST_MINI_OBJECT (event), "GstEvent", 1);
/* check TOC message handling */
message = gst_message_new_toc (NULL, toc, TRUE);
fail_if (message == NULL);
- fail_if (event->structure == NULL);
fail_unless (message->type == GST_MESSAGE_TOC);
ASSERT_MINI_OBJECT_REFCOUNT (GST_MINI_OBJECT (message), "GstMessage", 1);
/* check TOC select event handling */
event = gst_event_new_toc_select (TEST_UID);
fail_if (event == NULL);
- fail_if (event->structure == NULL);
fail_unless (event->type == GST_EVENT_TOC_SELECT);
ASSERT_MINI_OBJECT_REFCOUNT (GST_MINI_OBJECT (event), "GstEvent", 1);
query = gst_query_new_toc ();
fail_if (query == NULL);
gst_query_set_toc (query, toc, TEST_UID);
- fail_if (query->structure == NULL);
fail_unless (query->type == GST_QUERY_TOC);
ASSERT_MINI_OBJECT_REFCOUNT (GST_MINI_OBJECT (query), "GstQuery", 1);
typedef GstElement GstDummyEnc;
typedef GstElementClass GstDummyEncClass;
-static void gst_dummy_enc_add_interfaces (GType enc_type);
-
GType gst_dummy_enc_get_type (void);
-GST_BOILERPLATE_FULL (GstDummyEnc, gst_dummy_enc, GstElement,
- GST_TYPE_ELEMENT, gst_dummy_enc_add_interfaces);
-
-static void
-gst_dummy_enc_add_interfaces (GType enc_type)
-{
- static const GInterfaceInfo toc_setter_info = { NULL, NULL, NULL };
-
- g_type_add_interface_static (enc_type, GST_TYPE_TOC_SETTER, &toc_setter_info);
-}
-
-static void
-gst_dummy_enc_base_init (gpointer g_class)
-{
-}
+G_DEFINE_TYPE_WITH_CODE (GstDummyEnc, gst_dummy_enc,
+ GST_TYPE_ELEMENT, G_IMPLEMENT_INTERFACE (GST_TYPE_TOC_SETTER, NULL));
static void
gst_dummy_enc_class_init (GstDummyEncClass * klass)
}
static void
-gst_dummy_enc_init (GstDummyEnc * enc, GstDummyEncClass * klass)
+gst_dummy_enc_init (GstDummyEnc * enc)
{
}