gst/: Make subbufer unref the parent in finalize. some more debugging info.

Original commit message from CVS:
* gst/gstbuffer.c: (gst_buffer_init), (gst_subbuffer_get_type),
(gst_subbuffer_class_init), (gst_subbuffer_finalize),
(gst_subbuffer_init), (gst_buffer_is_span_fast):
* gst/gstbuffer.h:
* gst/gstbus.c: (gst_bus_post):
* gst/gstelement.c: (gst_element_get_random_pad):
* gst/gstmessage.c: (gst_message_init), (gst_message_finalize):
Make subbufer unref the parent in finalize.
some more debugging info.
This commit is contained in:
Wim Taymans 2005-05-19 16:26:50 +00:00
parent 637c74bdb8
commit fbe9b20d09
6 changed files with 43 additions and 13 deletions

View file

@ -1,3 +1,16 @@
2005-05-19 Wim Taymans <wim@fluendo.com>
* gst/gstbuffer.c: (gst_buffer_init), (gst_subbuffer_get_type),
(gst_subbuffer_class_init), (gst_subbuffer_finalize),
(gst_subbuffer_init), (gst_buffer_is_span_fast):
* gst/gstbuffer.h:
* gst/gstbus.c: (gst_bus_post):
* gst/gstelement.c: (gst_element_get_random_pad):
* gst/gstmessage.c: (gst_message_init), (gst_message_finalize):
Make subbufer unref the parent in finalize.
some more debugging info.
2005-05-19 Wim Taymans <wim@fluendo.com>
* gst/base/gstbasesink.c: (gst_basesink_class_init),

View file

@ -148,13 +148,10 @@ gst_buffer_init (GTypeInstance * instance, gpointer g_class)
GST_CAT_LOG (GST_CAT_BUFFER, "init %p", buffer);
//GST_BUFFER_DATA (buffer) = NULL;
//GST_BUFFER_SIZE (buffer) = 0;
GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE;
GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
GST_BUFFER_OFFSET (buffer) = GST_BUFFER_OFFSET_NONE;
GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE;
//GST_BUFFER_CAPS (buffer) = NULL;
}
/**
@ -270,19 +267,23 @@ struct _GstSubBufferClass
GstBufferClass buffer_class;
};
static GstBufferClass *sub_parent_class;
static void gst_subbuffer_init (GTypeInstance * instance, gpointer g_class);
static void gst_subbuffer_class_init (gpointer g_class, gpointer class_data);
static void gst_subbuffer_finalize (GstSubBuffer * buffer);
static GType
gst_subbuffer_get_type (void)
{
static GType _gst_subbuffer_type;
static GType _gst_subbuffer_type = 0;
if (G_UNLIKELY (_gst_subbuffer_type == 0)) {
static const GTypeInfo subbuffer_info = {
sizeof (GstSubBufferClass),
NULL,
NULL,
NULL,
gst_subbuffer_class_init,
NULL,
NULL,
sizeof (GstSubBuffer),
@ -297,10 +298,28 @@ gst_subbuffer_get_type (void)
return _gst_subbuffer_type;
}
static void
gst_subbuffer_class_init (gpointer g_class, gpointer class_data)
{
GstBufferClass *buffer_class = GST_BUFFER_CLASS (g_class);
sub_parent_class = g_type_class_ref (GST_TYPE_BUFFER);
buffer_class->mini_object_class.finalize =
(GstMiniObjectFinalizeFunction) gst_subbuffer_finalize;
}
static void
gst_subbuffer_finalize (GstSubBuffer * buffer)
{
gst_buffer_unref (buffer->parent);
GST_MINI_OBJECT_CLASS (sub_parent_class)->finalize (GST_MINI_OBJECT (buffer));
}
static void
gst_subbuffer_init (GTypeInstance * instance, gpointer g_class)
{
}
/**

View file

@ -160,9 +160,6 @@ GstBuffer* gst_buffer_span (GstBuffer *buf1, guint32 offset, GstBuffer *buf2,
/* --- protected --- */
void _gst_buffer_initialize (void);
void gst_buffer_default_free (GstBuffer *buffer);
GstBuffer* gst_buffer_default_copy (GstBuffer *buffer);
G_END_DECLS
#endif /* __GST_BUFFER_H__ */

View file

@ -203,8 +203,8 @@ gst_bus_post (GstBus * bus, GstMessage * message)
g_return_val_if_fail (GST_IS_BUS (bus), FALSE);
g_return_val_if_fail (GST_IS_MESSAGE (message), FALSE);
//g_print ("posting message on bus, type %d\n", GST_MESSAGE_TYPE (message));
GST_DEBUG_OBJECT (bus, "posting message on bus");
GST_DEBUG_OBJECT (bus, "posting message on bus, type %d",
GST_MESSAGE_TYPE (message));
GST_LOCK (bus);

View file

@ -1040,7 +1040,7 @@ gst_element_get_random_pad (GstElement * element, GstPadDirection dir)
/* ERROR handling */
wrong_direction:
{
g_warning ("unknown pad direction");
g_warning ("unknown pad direction %d", dir);
return NULL;
}
}

View file

@ -102,7 +102,6 @@ gst_message_init (GTypeInstance * instance, gpointer g_class)
GstMessage *message = GST_MESSAGE (instance);
message->timestamp = GST_CLOCK_TIME_NONE;
}
static void
@ -110,6 +109,8 @@ gst_message_finalize (GstMessage * message)
{
g_return_if_fail (message != NULL);
GST_CAT_INFO (GST_CAT_MESSAGE, "finalize message %p", message);
if (GST_MESSAGE_SRC (message)) {
gst_object_unref (GST_MESSAGE_SRC (message));
}