toc: port to 0.11

This commit is contained in:
Stefan Sauer 2012-04-02 22:09:07 +02:00
parent 1074a4e99a
commit 3b0af8df9e
7 changed files with 26 additions and 39 deletions

View file

@ -1690,7 +1690,7 @@ gst_event_new_toc_select (const gchar * uid)
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);

View file

@ -2225,8 +2225,8 @@ gst_message_parse_toc (GstMessage * message, GstToc ** toc, gboolean * updated)
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));
}

View file

@ -2335,8 +2335,10 @@ GstQuery *
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;
}
@ -2354,6 +2356,7 @@ void
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);
@ -2364,15 +2367,17 @@ gst_query_set_toc (GstQuery * query, GstToc * toc, const gchar * extend_uid)
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;
}
/**

View file

@ -170,8 +170,8 @@ gst_toc_new (void)
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;
}
@ -197,8 +197,8 @@ gst_toc_entry_new (GstTocEntryType type, const gchar * uid)
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;
}
@ -227,7 +227,7 @@ gst_toc_entry_new_with_pad (GstTocEntryType type, const gchar * uid,
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));
@ -306,7 +306,7 @@ gst_toc_structure_new (GstTagList * tags, GstStructure * info)
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);
@ -332,7 +332,7 @@ gst_toc_entry_structure_new (GstTocEntryType type, const gchar * uid,
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);
@ -884,7 +884,7 @@ gst_toc_entry_set_start_stop (GstTocEntry * entry, gint64 start, gint64 stop)
}
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,

View file

@ -23,6 +23,7 @@
#define __GST_TOC_H__
#include <gst/gstconfig.h>
#include <gst/gststructure.h>
#include <gst/gsttaglist.h>
#include <gst/gstformat.h>

View file

@ -249,7 +249,6 @@ GST_START_TEST (test_serializing)
/* 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);
@ -265,7 +264,6 @@ GST_START_TEST (test_serializing)
/* 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);
@ -280,7 +278,6 @@ GST_START_TEST (test_serializing)
/* 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);
@ -293,7 +290,6 @@ GST_START_TEST (test_serializing)
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);

View file

@ -114,24 +114,9 @@
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)
@ -139,7 +124,7 @@ gst_dummy_enc_class_init (GstDummyEncClass * klass)
}
static void
gst_dummy_enc_init (GstDummyEnc * enc, GstDummyEncClass * klass)
gst_dummy_enc_init (GstDummyEnc * enc)
{
}