mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
gst/: Avoid excessive typechecking in macros.
Original commit message from CVS: * gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty), (gst_base_sink_do_sync), (gst_base_sink_handle_event), (gst_base_sink_chain), (gst_base_sink_change_state): * gst/base/gstbasesink.h: * gst/base/gstbasesrc.h: * gst/gstelement.h: * gst/gstevent.h: Avoid excessive typechecking in macros. * gst/gstminiobject.c: (gst_mini_object_get_type), (gst_mini_object_init), (gst_mini_object_new), (gst_mini_object_free): * gst/gstobject.c: (gst_object_class_init), (gst_object_init), (gst_object_finalize): Remove cruft code, optimize alloc_trace.
This commit is contained in:
parent
eeaf7dcf19
commit
5bb924622f
11 changed files with 86 additions and 116 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2005-11-08 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
|
||||
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
|
||||
(gst_base_sink_chain), (gst_base_sink_change_state):
|
||||
* gst/base/gstbasesink.h:
|
||||
* gst/base/gstbasesrc.h:
|
||||
* gst/gstelement.h:
|
||||
* gst/gstevent.h:
|
||||
Avoid excessive typechecking in macros.
|
||||
|
||||
* gst/gstminiobject.c: (gst_mini_object_get_type),
|
||||
(gst_mini_object_init), (gst_mini_object_new),
|
||||
(gst_mini_object_free):
|
||||
* gst/gstobject.c: (gst_object_class_init), (gst_object_init),
|
||||
(gst_object_finalize):
|
||||
Remove cruft code, optimize alloc_trace.
|
||||
|
||||
2005-11-07 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* docs/faq/gst-uninstalled:
|
||||
|
|
|
@ -383,7 +383,7 @@ gst_base_sink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
|
|||
gboolean is_buffer;
|
||||
|
||||
is_buffer = GST_IS_BUFFER (obj);
|
||||
if (is_buffer) {
|
||||
if (G_LIKELY (is_buffer)) {
|
||||
basesink->preroll_queued--;
|
||||
basesink->buffers_queued--;
|
||||
} else {
|
||||
|
@ -401,12 +401,12 @@ gst_base_sink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
|
|||
* inside the element. */
|
||||
GST_PREROLL_UNLOCK (pad);
|
||||
|
||||
if (is_buffer) {
|
||||
if (G_LIKELY (is_buffer)) {
|
||||
GST_DEBUG_OBJECT (basesink, "popped buffer %p", obj);
|
||||
ret = gst_base_sink_handle_buffer (basesink, GST_BUFFER (obj));
|
||||
ret = gst_base_sink_handle_buffer (basesink, GST_BUFFER_CAST (obj));
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (basesink, "popped event %p", obj);
|
||||
gst_base_sink_handle_event (basesink, GST_EVENT (obj));
|
||||
gst_base_sink_handle_event (basesink, GST_EVENT_CAST (obj));
|
||||
ret = GST_FLOW_OK;
|
||||
}
|
||||
|
||||
|
@ -1033,7 +1033,7 @@ gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
|
|||
|
||||
GST_LOCK (basesink);
|
||||
|
||||
base_time = GST_ELEMENT (basesink)->base_time;
|
||||
base_time = GST_ELEMENT_CAST (basesink)->base_time;
|
||||
|
||||
GST_LOG_OBJECT (basesink,
|
||||
"waiting for clock, base time %" GST_TIME_FORMAT
|
||||
|
@ -1107,8 +1107,8 @@ gst_base_sink_handle_event (GstBaseSink * basesink, GstEvent * event)
|
|||
if (basesink->eos) {
|
||||
/* ok, now we can post the message */
|
||||
GST_DEBUG_OBJECT (basesink, "Now posting EOS");
|
||||
gst_element_post_message (GST_ELEMENT (basesink),
|
||||
gst_message_new_eos (GST_OBJECT (basesink)));
|
||||
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
||||
gst_message_new_eos (GST_OBJECT_CAST (basesink)));
|
||||
basesink->eos_queued = FALSE;
|
||||
}
|
||||
GST_PREROLL_UNLOCK (basesink->sinkpad);
|
||||
|
@ -1177,7 +1177,8 @@ gst_base_sink_chain (GstPad * pad, GstBuffer * buf)
|
|||
goto done;
|
||||
}
|
||||
|
||||
result = gst_base_sink_handle_object (basesink, pad, GST_MINI_OBJECT (buf));
|
||||
result =
|
||||
gst_base_sink_handle_object (basesink, pad, GST_MINI_OBJECT_CAST (buf));
|
||||
|
||||
done:
|
||||
gst_object_unref (basesink);
|
||||
|
@ -1562,8 +1563,8 @@ gst_base_sink_change_state (GstElement * element, GstStateChange transition)
|
|||
* just emptied. */
|
||||
if (do_eos) {
|
||||
GST_DEBUG_OBJECT (basesink, "Now posting EOS");
|
||||
gst_element_post_message (GST_ELEMENT (basesink),
|
||||
gst_message_new_eos (GST_OBJECT (basesink)));
|
||||
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
||||
gst_message_new_eos (GST_OBJECT_CAST (basesink)));
|
||||
}
|
||||
} else if (!basesink->have_preroll) {
|
||||
/* queue a commit_state */
|
||||
|
|
|
@ -34,6 +34,7 @@ G_BEGIN_DECLS
|
|||
#define GST_BASE_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_SINK, GstBaseSinkClass))
|
||||
#define GST_IS_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_SINK))
|
||||
#define GST_IS_BASE_SINK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_SINK))
|
||||
#define GST_BASE_SINK_CAST(obj) ((GstBaseSink *) (obj))
|
||||
|
||||
/**
|
||||
* GST_BASE_SINK_CLOCK:
|
||||
|
@ -41,14 +42,14 @@ G_BEGIN_DECLS
|
|||
*
|
||||
* Gives the pointer to the #GstClock object of the element.
|
||||
*/
|
||||
#define GST_BASE_SINK_CLOCK(obj) (GST_BASE_SINK (obj)->clock)
|
||||
#define GST_BASE_SINK_CLOCK(obj) (GST_BASE_SINK_CAST (obj)->clock)
|
||||
/**
|
||||
* GST_BASE_SINK_PAD:
|
||||
* @obj: base sink instance
|
||||
*
|
||||
* Gives the pointer to the #GstPad object of the element.
|
||||
*/
|
||||
#define GST_BASE_SINK_PAD(obj) (GST_BASE_SINK (obj)->sinkpad)
|
||||
#define GST_BASE_SINK_PAD(obj) (GST_BASE_SINK_CAST (obj)->sinkpad)
|
||||
|
||||
typedef struct _GstBaseSink GstBaseSink;
|
||||
typedef struct _GstBaseSinkClass GstBaseSinkClass;
|
||||
|
|
|
@ -34,6 +34,7 @@ G_BEGIN_DECLS
|
|||
#define GST_BASE_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_SRC, GstBaseSrcClass))
|
||||
#define GST_IS_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_SRC))
|
||||
#define GST_IS_BASE_SRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_SRC))
|
||||
#define GST_BASE_SRC_CAST(obj) ((GstBaseSrc *)(obj))
|
||||
|
||||
/**
|
||||
* GstBaseSrcFlags:
|
||||
|
@ -57,13 +58,13 @@ typedef struct _GstBaseSrcClass GstBaseSrcClass;
|
|||
*
|
||||
* Gives the pointer to the #GstPad object of the element.
|
||||
*/
|
||||
#define GST_BASE_SRC_PAD(obj) (GST_BASE_SRC (obj)->srcpad)
|
||||
#define GST_BASE_SRC_PAD(obj) (GST_BASE_SRC_CAST (obj)->srcpad)
|
||||
|
||||
#define GST_LIVE_GET_LOCK(elem) (GST_BASE_SRC(elem)->live_lock)
|
||||
#define GST_LIVE_GET_LOCK(elem) (GST_BASE_SRC_CAST(elem)->live_lock)
|
||||
#define GST_LIVE_LOCK(elem) g_mutex_lock(GST_LIVE_GET_LOCK(elem))
|
||||
#define GST_LIVE_TRYLOCK(elem) g_mutex_trylock(GST_LIVE_GET_LOCK(elem))
|
||||
#define GST_LIVE_UNLOCK(elem) g_mutex_unlock(GST_LIVE_GET_LOCK(elem))
|
||||
#define GST_LIVE_GET_COND(elem) (GST_BASE_SRC(elem)->live_cond)
|
||||
#define GST_LIVE_GET_COND(elem) (GST_BASE_SRC_CAST(elem)->live_cond)
|
||||
#define GST_LIVE_WAIT(elem) g_cond_wait (GST_LIVE_GET_COND (elem), GST_LIVE_GET_LOCK (elem))
|
||||
#define GST_LIVE_TIMED_WAIT(elem, timeval) g_cond_timed_wait (GST_LIVE_GET_COND (elem), GST_LIVE_GET_LOCK (elem),\
|
||||
timeval)
|
||||
|
|
|
@ -99,7 +99,7 @@ typedef enum {
|
|||
*
|
||||
* This macro returns the current state of the element.
|
||||
*/
|
||||
#define GST_STATE(obj) (GST_ELEMENT(obj)->current_state)
|
||||
#define GST_STATE(obj) (GST_ELEMENT_CAST(obj)->current_state)
|
||||
|
||||
/**
|
||||
* GST_STATE_NEXT:
|
||||
|
@ -107,7 +107,7 @@ typedef enum {
|
|||
*
|
||||
* This macro returns the next state of the element.
|
||||
*/
|
||||
#define GST_STATE_NEXT(obj) (GST_ELEMENT(obj)->next_state)
|
||||
#define GST_STATE_NEXT(obj) (GST_ELEMENT_CAST(obj)->next_state)
|
||||
|
||||
/**
|
||||
* GST_STATE_PENDING:
|
||||
|
@ -115,7 +115,7 @@ typedef enum {
|
|||
*
|
||||
* This macro returns the currently pending state of the element.
|
||||
*/
|
||||
#define GST_STATE_PENDING(obj) (GST_ELEMENT(obj)->pending_state)
|
||||
#define GST_STATE_PENDING(obj) (GST_ELEMENT_CAST(obj)->pending_state)
|
||||
|
||||
/**
|
||||
* GST_STATE_RETURN:
|
||||
|
@ -123,7 +123,7 @@ typedef enum {
|
|||
*
|
||||
* This macro returns the last state change return value.
|
||||
*/
|
||||
#define GST_STATE_RETURN(obj) (GST_ELEMENT(obj)->last_return)
|
||||
#define GST_STATE_RETURN(obj) (GST_ELEMENT_CAST(obj)->last_return)
|
||||
|
||||
#define __GST_SIGN(val) ((val) < 0 ? -1 : ((val) > 0 ? 1 : 0))
|
||||
/**
|
||||
|
@ -438,7 +438,7 @@ GType gst_element_get_type (void);
|
|||
*
|
||||
* Gets the name of the element.
|
||||
*/
|
||||
#define gst_element_get_name(elem) gst_object_get_name(GST_OBJECT(elem))
|
||||
#define gst_element_get_name(elem) gst_object_get_name(GST_OBJECT_CAST(elem))
|
||||
|
||||
/**
|
||||
* gst_element_set_name:
|
||||
|
@ -447,7 +447,7 @@ GType gst_element_get_type (void);
|
|||
*
|
||||
* Sets the name of the element, getting rid of the old name if there was one.
|
||||
*/
|
||||
#define gst_element_set_name(elem,name) gst_object_set_name(GST_OBJECT(elem),name)
|
||||
#define gst_element_set_name(elem,name) gst_object_set_name(GST_OBJECT_CAST(elem),name)
|
||||
|
||||
/**
|
||||
* gst_element_get_parent:
|
||||
|
@ -455,7 +455,7 @@ GType gst_element_get_type (void);
|
|||
*
|
||||
* Gets the parent of an element.
|
||||
*/
|
||||
#define gst_element_get_parent(elem) gst_object_get_parent(GST_OBJECT(elem))
|
||||
#define gst_element_get_parent(elem) gst_object_get_parent(GST_OBJECT_CAST(elem))
|
||||
|
||||
/**
|
||||
* gst_element_set_parent:
|
||||
|
@ -464,7 +464,7 @@ GType gst_element_get_type (void);
|
|||
*
|
||||
* Sets the parent of an element.
|
||||
*/
|
||||
#define gst_element_set_parent(elem,parent) gst_object_set_parent(GST_OBJECT(elem),parent)
|
||||
#define gst_element_set_parent(elem,parent) gst_object_set_parent(GST_OBJECT_CAST(elem),parent)
|
||||
|
||||
/* clocking */
|
||||
gboolean gst_element_requires_clock (GstElement *element);
|
||||
|
|
|
@ -149,6 +149,7 @@ typedef struct _GstEventClass GstEventClass;
|
|||
#define GST_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_EVENT, GstEventClass))
|
||||
#define GST_EVENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_EVENT, GstEvent))
|
||||
#define GST_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_EVENT, GstEventClass))
|
||||
#define GST_EVENT_CAST(obj) ((GstEvent *)(obj))
|
||||
|
||||
/**
|
||||
* GST_EVENT_TYPE:
|
||||
|
@ -156,7 +157,7 @@ typedef struct _GstEventClass GstEventClass;
|
|||
*
|
||||
* Get the #GstEventType of the event.
|
||||
*/
|
||||
#define GST_EVENT_TYPE(event) (GST_EVENT(event)->type)
|
||||
#define GST_EVENT_TYPE(event) (GST_EVENT_CAST(event)->type)
|
||||
|
||||
/**
|
||||
* GST_EVENT_TYPE_NAME:
|
||||
|
@ -172,7 +173,7 @@ typedef struct _GstEventClass GstEventClass;
|
|||
*
|
||||
* Get the #GstClockTime timestamp of the event.
|
||||
*/
|
||||
#define GST_EVENT_TIMESTAMP(event) (GST_EVENT(event)->timestamp)
|
||||
#define GST_EVENT_TIMESTAMP(event) (GST_EVENT_CAST(event)->timestamp)
|
||||
|
||||
/**
|
||||
* GST_EVENT_SRC:
|
||||
|
@ -180,7 +181,7 @@ typedef struct _GstEventClass GstEventClass;
|
|||
*
|
||||
* The source #GstObject that generated this event.
|
||||
*/
|
||||
#define GST_EVENT_SRC(event) (GST_EVENT(event)->src)
|
||||
#define GST_EVENT_SRC(event) (GST_EVENT_CAST(event)->src)
|
||||
|
||||
/**
|
||||
* GST_EVENT_IS_UPSTREAM:
|
||||
|
@ -309,7 +310,7 @@ GType gst_event_get_type (void);
|
|||
*
|
||||
* Copy the event using the event specific copy function.
|
||||
*/
|
||||
#define gst_event_copy(ev) GST_EVENT (gst_mini_object_copy (GST_MINI_OBJECT (ev)))
|
||||
#define gst_event_copy(ev) GST_EVENT_CAST (gst_mini_object_copy (GST_MINI_OBJECT (ev)))
|
||||
|
||||
/* custom event */
|
||||
GstEvent* gst_event_new_custom (GstEventType type, GstStructure *structure);
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#ifndef GST_DISABLE_TRACE
|
||||
#include "gsttrace.h"
|
||||
static GstAllocTrace *_gst_mini_object_trace;
|
||||
#endif
|
||||
|
||||
#define DEBUG_REFCOUNT
|
||||
|
@ -95,6 +96,11 @@ gst_mini_object_get_type (void)
|
|||
_gst_mini_object_type = g_type_fundamental_next ();
|
||||
g_type_register_fundamental (_gst_mini_object_type, "GstMiniObject",
|
||||
&mini_object_info, &mini_object_fundamental_info, G_TYPE_FLAG_ABSTRACT);
|
||||
|
||||
#ifndef GST_DISABLE_TRACE
|
||||
_gst_mini_object_trace =
|
||||
gst_alloc_trace_register (g_type_name (_gst_mini_object_type));
|
||||
#endif
|
||||
}
|
||||
|
||||
return _gst_mini_object_type;
|
||||
|
@ -121,7 +127,7 @@ gst_mini_object_class_init (gpointer g_class, gpointer class_data)
|
|||
static void
|
||||
gst_mini_object_init (GTypeInstance * instance, gpointer klass)
|
||||
{
|
||||
GstMiniObject *mini_object = GST_MINI_OBJECT (instance);
|
||||
GstMiniObject *mini_object = GST_MINI_OBJECT_CAST (instance);
|
||||
|
||||
mini_object->refcount = 1;
|
||||
}
|
||||
|
@ -139,34 +145,14 @@ gst_mini_object_init (GTypeInstance * instance, gpointer klass)
|
|||
GstMiniObject *
|
||||
gst_mini_object_new (GType type)
|
||||
{
|
||||
//GstMiniObjectClass *klass;
|
||||
GstMiniObject *mini_object;
|
||||
|
||||
#if 0
|
||||
klass = g_type_class_peek_static (type);
|
||||
if (!klass) {
|
||||
g_warning ("cannot find class for type '%s'", g_type_name (type));
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
/* we don't support dynamic types because they really aren't useful,
|
||||
* and could cause refcount problems */
|
||||
|
||||
mini_object = (GstMiniObject *) g_type_create_instance (type);
|
||||
|
||||
#ifndef GST_DISABLE_TRACE
|
||||
{
|
||||
const gchar *name;
|
||||
GstAllocTrace *trace;
|
||||
|
||||
name = g_type_name (type);
|
||||
|
||||
trace = gst_alloc_trace_get (name);
|
||||
if (!trace) {
|
||||
trace = gst_alloc_trace_register (name);
|
||||
}
|
||||
gst_alloc_trace_new (trace, mini_object);
|
||||
}
|
||||
gst_alloc_trace_new (_gst_mini_object_trace, mini_object);
|
||||
#endif
|
||||
|
||||
return mini_object;
|
||||
|
@ -279,19 +265,7 @@ gst_mini_object_free (GstMiniObject * mini_object)
|
|||
* object, else the finalize method recycled the object */
|
||||
if (g_atomic_int_get (&mini_object->refcount) == 0) {
|
||||
#ifndef GST_DISABLE_TRACE
|
||||
{
|
||||
const gchar *name;
|
||||
GstAllocTrace *trace;
|
||||
|
||||
name = g_type_name (G_TYPE_FROM_CLASS (mo_class));
|
||||
|
||||
trace = gst_alloc_trace_get (name);
|
||||
if (G_LIKELY (trace)) {
|
||||
gst_alloc_trace_free (trace, mini_object);
|
||||
} else {
|
||||
g_warning ("Untraced miniobject: (%s)%p", name, mini_object);
|
||||
}
|
||||
}
|
||||
gst_alloc_trace_free (_gst_mini_object_trace, mini_object);
|
||||
#endif
|
||||
g_type_free_instance ((GTypeInstance *) mini_object);
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
|
||||
#ifndef GST_DISABLE_TRACE
|
||||
#include "gsttrace.h"
|
||||
static GstAllocTrace *_gst_object_trace;
|
||||
#endif
|
||||
|
||||
#define DEBUG_REFCOUNT
|
||||
|
@ -156,11 +157,6 @@ static guint gst_signal_object_signals[SO_LAST_SIGNAL] = { 0 };
|
|||
static void gst_object_class_init (GstObjectClass * klass);
|
||||
static void gst_object_init (GTypeInstance * instance, gpointer g_class);
|
||||
|
||||
#ifndef GST_DISABLE_TRACE
|
||||
static GObject *gst_object_constructor (GType type,
|
||||
guint n_construct_properties, GObjectConstructParam * construct_params);
|
||||
#endif
|
||||
|
||||
static void gst_object_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
static void gst_object_get_property (GObject * object, guint prop_id,
|
||||
|
@ -217,6 +213,10 @@ gst_object_class_init (GstObjectClass * klass)
|
|||
|
||||
parent_class = g_type_class_ref (G_TYPE_OBJECT);
|
||||
|
||||
#ifndef GST_DISABLE_TRACE
|
||||
_gst_object_trace = gst_alloc_trace_register (g_type_name (GST_TYPE_OBJECT));
|
||||
#endif
|
||||
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_object_set_property);
|
||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_object_get_property);
|
||||
|
||||
|
@ -297,9 +297,6 @@ gst_object_class_init (GstObjectClass * klass)
|
|||
|
||||
gobject_class->dispose = gst_object_dispose;
|
||||
gobject_class->finalize = gst_object_finalize;
|
||||
#ifndef GST_DISABLE_TRACE
|
||||
gobject_class->constructor = gst_object_constructor;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -316,32 +313,14 @@ gst_object_init (GTypeInstance * instance, gpointer g_class)
|
|||
#endif
|
||||
PATCH_REFCOUNT (object);
|
||||
|
||||
#ifndef GST_DISABLE_TRACE
|
||||
gst_alloc_trace_new (_gst_object_trace, object);
|
||||
#endif
|
||||
|
||||
object->flags = 0;
|
||||
GST_OBJECT_FLAG_SET (object, GST_OBJECT_FLOATING);
|
||||
}
|
||||
|
||||
#ifndef GST_DISABLE_TRACE
|
||||
static GObject *
|
||||
gst_object_constructor (GType type, guint n_construct_properties,
|
||||
GObjectConstructParam * construct_params)
|
||||
{
|
||||
const gchar *name;
|
||||
GstAllocTrace *trace;
|
||||
GObject *obj =
|
||||
G_OBJECT_CLASS (parent_class)->constructor (type, n_construct_properties,
|
||||
construct_params);
|
||||
|
||||
name = g_type_name (type);
|
||||
|
||||
trace = gst_alloc_trace_get (name);
|
||||
if (!trace) {
|
||||
trace = gst_alloc_trace_register (name);
|
||||
}
|
||||
gst_alloc_trace_new (trace, obj);
|
||||
|
||||
return obj;
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* gst_object_ref:
|
||||
* @object: GstObject to reference
|
||||
|
@ -536,15 +515,7 @@ gst_object_finalize (GObject * object)
|
|||
g_mutex_free (gstobject->lock);
|
||||
|
||||
#ifndef GST_DISABLE_TRACE
|
||||
{
|
||||
const gchar *name;
|
||||
GstAllocTrace *trace;
|
||||
|
||||
name = g_type_name (G_OBJECT_TYPE (object));
|
||||
trace = gst_alloc_trace_get (name);
|
||||
g_assert (trace);
|
||||
gst_alloc_trace_free (trace, object);
|
||||
}
|
||||
gst_alloc_trace_free (_gst_object_trace, object);
|
||||
#endif
|
||||
|
||||
parent_class->finalize (object);
|
||||
|
|
|
@ -383,7 +383,7 @@ gst_base_sink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
|
|||
gboolean is_buffer;
|
||||
|
||||
is_buffer = GST_IS_BUFFER (obj);
|
||||
if (is_buffer) {
|
||||
if (G_LIKELY (is_buffer)) {
|
||||
basesink->preroll_queued--;
|
||||
basesink->buffers_queued--;
|
||||
} else {
|
||||
|
@ -401,12 +401,12 @@ gst_base_sink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
|
|||
* inside the element. */
|
||||
GST_PREROLL_UNLOCK (pad);
|
||||
|
||||
if (is_buffer) {
|
||||
if (G_LIKELY (is_buffer)) {
|
||||
GST_DEBUG_OBJECT (basesink, "popped buffer %p", obj);
|
||||
ret = gst_base_sink_handle_buffer (basesink, GST_BUFFER (obj));
|
||||
ret = gst_base_sink_handle_buffer (basesink, GST_BUFFER_CAST (obj));
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (basesink, "popped event %p", obj);
|
||||
gst_base_sink_handle_event (basesink, GST_EVENT (obj));
|
||||
gst_base_sink_handle_event (basesink, GST_EVENT_CAST (obj));
|
||||
ret = GST_FLOW_OK;
|
||||
}
|
||||
|
||||
|
@ -1033,7 +1033,7 @@ gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
|
|||
|
||||
GST_LOCK (basesink);
|
||||
|
||||
base_time = GST_ELEMENT (basesink)->base_time;
|
||||
base_time = GST_ELEMENT_CAST (basesink)->base_time;
|
||||
|
||||
GST_LOG_OBJECT (basesink,
|
||||
"waiting for clock, base time %" GST_TIME_FORMAT
|
||||
|
@ -1107,8 +1107,8 @@ gst_base_sink_handle_event (GstBaseSink * basesink, GstEvent * event)
|
|||
if (basesink->eos) {
|
||||
/* ok, now we can post the message */
|
||||
GST_DEBUG_OBJECT (basesink, "Now posting EOS");
|
||||
gst_element_post_message (GST_ELEMENT (basesink),
|
||||
gst_message_new_eos (GST_OBJECT (basesink)));
|
||||
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
||||
gst_message_new_eos (GST_OBJECT_CAST (basesink)));
|
||||
basesink->eos_queued = FALSE;
|
||||
}
|
||||
GST_PREROLL_UNLOCK (basesink->sinkpad);
|
||||
|
@ -1177,7 +1177,8 @@ gst_base_sink_chain (GstPad * pad, GstBuffer * buf)
|
|||
goto done;
|
||||
}
|
||||
|
||||
result = gst_base_sink_handle_object (basesink, pad, GST_MINI_OBJECT (buf));
|
||||
result =
|
||||
gst_base_sink_handle_object (basesink, pad, GST_MINI_OBJECT_CAST (buf));
|
||||
|
||||
done:
|
||||
gst_object_unref (basesink);
|
||||
|
@ -1562,8 +1563,8 @@ gst_base_sink_change_state (GstElement * element, GstStateChange transition)
|
|||
* just emptied. */
|
||||
if (do_eos) {
|
||||
GST_DEBUG_OBJECT (basesink, "Now posting EOS");
|
||||
gst_element_post_message (GST_ELEMENT (basesink),
|
||||
gst_message_new_eos (GST_OBJECT (basesink)));
|
||||
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
||||
gst_message_new_eos (GST_OBJECT_CAST (basesink)));
|
||||
}
|
||||
} else if (!basesink->have_preroll) {
|
||||
/* queue a commit_state */
|
||||
|
|
|
@ -34,6 +34,7 @@ G_BEGIN_DECLS
|
|||
#define GST_BASE_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_SINK, GstBaseSinkClass))
|
||||
#define GST_IS_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_SINK))
|
||||
#define GST_IS_BASE_SINK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_SINK))
|
||||
#define GST_BASE_SINK_CAST(obj) ((GstBaseSink *) (obj))
|
||||
|
||||
/**
|
||||
* GST_BASE_SINK_CLOCK:
|
||||
|
@ -41,14 +42,14 @@ G_BEGIN_DECLS
|
|||
*
|
||||
* Gives the pointer to the #GstClock object of the element.
|
||||
*/
|
||||
#define GST_BASE_SINK_CLOCK(obj) (GST_BASE_SINK (obj)->clock)
|
||||
#define GST_BASE_SINK_CLOCK(obj) (GST_BASE_SINK_CAST (obj)->clock)
|
||||
/**
|
||||
* GST_BASE_SINK_PAD:
|
||||
* @obj: base sink instance
|
||||
*
|
||||
* Gives the pointer to the #GstPad object of the element.
|
||||
*/
|
||||
#define GST_BASE_SINK_PAD(obj) (GST_BASE_SINK (obj)->sinkpad)
|
||||
#define GST_BASE_SINK_PAD(obj) (GST_BASE_SINK_CAST (obj)->sinkpad)
|
||||
|
||||
typedef struct _GstBaseSink GstBaseSink;
|
||||
typedef struct _GstBaseSinkClass GstBaseSinkClass;
|
||||
|
|
|
@ -34,6 +34,7 @@ G_BEGIN_DECLS
|
|||
#define GST_BASE_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_SRC, GstBaseSrcClass))
|
||||
#define GST_IS_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_SRC))
|
||||
#define GST_IS_BASE_SRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_SRC))
|
||||
#define GST_BASE_SRC_CAST(obj) ((GstBaseSrc *)(obj))
|
||||
|
||||
/**
|
||||
* GstBaseSrcFlags:
|
||||
|
@ -57,13 +58,13 @@ typedef struct _GstBaseSrcClass GstBaseSrcClass;
|
|||
*
|
||||
* Gives the pointer to the #GstPad object of the element.
|
||||
*/
|
||||
#define GST_BASE_SRC_PAD(obj) (GST_BASE_SRC (obj)->srcpad)
|
||||
#define GST_BASE_SRC_PAD(obj) (GST_BASE_SRC_CAST (obj)->srcpad)
|
||||
|
||||
#define GST_LIVE_GET_LOCK(elem) (GST_BASE_SRC(elem)->live_lock)
|
||||
#define GST_LIVE_GET_LOCK(elem) (GST_BASE_SRC_CAST(elem)->live_lock)
|
||||
#define GST_LIVE_LOCK(elem) g_mutex_lock(GST_LIVE_GET_LOCK(elem))
|
||||
#define GST_LIVE_TRYLOCK(elem) g_mutex_trylock(GST_LIVE_GET_LOCK(elem))
|
||||
#define GST_LIVE_UNLOCK(elem) g_mutex_unlock(GST_LIVE_GET_LOCK(elem))
|
||||
#define GST_LIVE_GET_COND(elem) (GST_BASE_SRC(elem)->live_cond)
|
||||
#define GST_LIVE_GET_COND(elem) (GST_BASE_SRC_CAST(elem)->live_cond)
|
||||
#define GST_LIVE_WAIT(elem) g_cond_wait (GST_LIVE_GET_COND (elem), GST_LIVE_GET_LOCK (elem))
|
||||
#define GST_LIVE_TIMED_WAIT(elem, timeval) g_cond_timed_wait (GST_LIVE_GET_COND (elem), GST_LIVE_GET_LOCK (elem),\
|
||||
timeval)
|
||||
|
|
Loading…
Reference in a new issue