Commit 68b53ac4 authored by Wim Taymans's avatar Wim Taymans

- Cleanups

Original commit message from CVS:
- Cleanups
- Added padding to structs
- fixed typechecking/casts
- reduced casts
- implemented remove_element in gstbin
- implemented set index on bin
parent 54ad9d5e
......@@ -30,6 +30,7 @@
#include "gstlog.h"
#include "gstscheduler.h"
#include "gstindex.h"
GstElementDetails gst_bin_details = {
"Generic bin",
......@@ -48,6 +49,8 @@ static void gst_bin_dispose (GObject * object);
static GstElementStateReturn gst_bin_change_state (GstElement *element);
static GstElementStateReturn gst_bin_change_state_norecurse (GstBin *bin);
static void gst_bin_set_index (GstBin *bin, GstIndex *index);
static gboolean gst_bin_iterate_func (GstBin * bin);
#ifndef GST_DISABLE_LOADSAVE
......@@ -58,7 +61,8 @@ static void gst_bin_restore_thyself (GstObject * object, xmlNodePtr self);
/* Bin signals and args */
enum
{
OBJECT_ADDED,
ELEMENT_ADDED,
ELEMENT_REMOVED,
LAST_SIGNAL
};
......@@ -109,12 +113,17 @@ gst_bin_class_init (GstBinClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gst_bin_signals[OBJECT_ADDED] =
g_signal_new ("object_added", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GstBinClass, object_added), NULL, NULL,
gst_bin_signals[ELEMENT_ADDED] =
g_signal_new ("element_added", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GstBinClass, element_added), NULL, NULL,
gst_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
gst_bin_signals[ELEMENT_REMOVED] =
g_signal_new ("element_removed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GstBinClass, element_removed), NULL, NULL,
gst_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_bin_dispose);
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_bin_dispose);
#ifndef GST_DISABLE_LOADSAVE
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR (gst_bin_save_thyself);
......@@ -122,6 +131,7 @@ gst_bin_class_init (GstBinClass * klass)
#endif
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_bin_change_state);
gstelement_class->set_index = GST_DEBUG_FUNCPTR (gst_bin_set_index);
klass->iterate = GST_DEBUG_FUNCPTR (gst_bin_iterate_func);
}
......@@ -137,8 +147,8 @@ gst_bin_init (GstBin * bin)
bin->pre_iterate_func = NULL;
bin->post_iterate_func = NULL;
bin->pre_iterate_private = NULL;
bin->post_iterate_private = NULL;
bin->pre_iterate_data = NULL;
bin->post_iterate_data = NULL;
}
/**
......@@ -210,16 +220,31 @@ gst_bin_auto_clock (GstBin *bin)
}
static void
gst_bin_set_element_sched (GstElement *element, GstScheduler *sched)
gst_bin_set_index (GstBin *bin, GstIndex *index)
{
GList *children;
GstElement *child;
g_return_if_fail (GST_IS_BIN (bin));
children = bin->children;
while (children) {
GstElement *child = GST_ELEMENT (children->data);
children = g_list_next (children);
gst_element_set_index (child, index);
}
}
static void
gst_bin_set_element_sched (GstElement *element, GstScheduler *sched)
{
GST_INFO (GST_CAT_SCHEDULING, "setting element \"%s\" sched to %p", GST_ELEMENT_NAME (element),
sched);
/* if it's actually a Bin */
if (GST_IS_BIN (element)) {
GList *children;
if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_MANAGER)) {
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "child is already a manager, not resetting");
if (GST_ELEMENT_SCHED (element))
......@@ -233,7 +258,7 @@ gst_bin_set_element_sched (GstElement *element, GstScheduler *sched)
/* set the children's schedule */
children = GST_BIN (element)->children;
while (children) {
child = GST_ELEMENT (children->data);
GstElement *child = GST_ELEMENT (children->data);
children = g_list_next (children);
gst_bin_set_element_sched (child, sched);
......@@ -431,7 +456,7 @@ gst_bin_add (GstBin *bin, GstElement *element)
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "added child \"%s\"", GST_ELEMENT_NAME (element));
g_signal_emit (G_OBJECT (bin), gst_bin_signals[OBJECT_ADDED], 0, element);
g_signal_emit (G_OBJECT (bin), gst_bin_signals[ELEMENT_ADDED], 0, element);
}
/**
......@@ -486,6 +511,8 @@ gst_bin_remove (GstBin *bin, GstElement *element)
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "removed child %s", GST_ELEMENT_NAME (element));
/* ref as we're going to emit a signal */
gst_object_ref (GST_OBJECT (element));
gst_object_unparent (GST_OBJECT (element));
/* if we're down to zero children, force state to NULL */
......@@ -493,6 +520,10 @@ gst_bin_remove (GstBin *bin, GstElement *element)
GST_STATE_PENDING (bin) = GST_STATE_NULL;
gst_bin_change_state_norecurse (bin);
}
g_signal_emit (G_OBJECT (bin), gst_bin_signals[ELEMENT_REMOVED], 0, element);
/* element is really out of our control now */
gst_object_unref (GST_OBJECT (element));
}
/**
......@@ -860,16 +891,16 @@ gst_bin_iterate (GstBin *bin)
g_return_val_if_fail (bin != NULL, FALSE);
g_return_val_if_fail (GST_IS_BIN (bin), FALSE);
oclass = GST_BIN_CLASS (G_OBJECT_GET_CLASS (bin));
oclass = GST_BIN_GET_CLASS (bin);
if (bin->pre_iterate_func)
(bin->pre_iterate_func) (bin, bin->pre_iterate_private);
(bin->pre_iterate_func) (bin, bin->pre_iterate_data);
if (oclass->iterate)
running = (oclass->iterate) (bin);
if (bin->post_iterate_func)
(bin->post_iterate_func) (bin, bin->post_iterate_private);
(bin->post_iterate_func) (bin, bin->post_iterate_data);
GST_DEBUG_LEAVE ("(\"%s\") %d", GST_ELEMENT_NAME (bin), running);
......@@ -891,13 +922,13 @@ gst_bin_iterate (GstBin *bin)
* gst_bin_set_pre_iterate_function:
* @bin: #Gstbin to attach to
* @func: callback function to call
* @func_data: private data to put in the function call
* @user_data: user data to put in the function call
*
* Attaches a callback which will be run before every iteration of the bin
*
*/
void
gst_bin_set_pre_iterate_function (GstBin *bin, GstBinPrePostIterateFunction func, gpointer func_data)
gst_bin_set_pre_iterate_function (GstBin *bin, GstBinPrePostIterateFunction func, gpointer user_data)
{
g_return_if_fail (GST_IS_BIN (bin));
......@@ -905,20 +936,20 @@ gst_bin_set_pre_iterate_function (GstBin *bin, GstBinPrePostIterateFunction func
g_warning ("setting pre_iterate on a non MANAGER bin has no effect");
bin->pre_iterate_func = func;
bin->pre_iterate_private = func_data;
bin->pre_iterate_data = user_data;
}
/**
* gst_bin_set_post_iterate_function:
* @bin: #Gstbin to attach to
* @func: callback function to call
* @func_data: private data to put in the function call
* @user_data: user data to put in the function call
*
* Attaches a callback which will be run after every iteration of the bin
*
*/
void
gst_bin_set_post_iterate_function (GstBin *bin, GstBinPrePostIterateFunction func, gpointer func_data)
gst_bin_set_post_iterate_function (GstBin *bin, GstBinPrePostIterateFunction func, gpointer user_data)
{
g_return_if_fail (GST_IS_BIN (bin));
......@@ -926,6 +957,6 @@ gst_bin_set_post_iterate_function (GstBin *bin, GstBinPrePostIterateFunction fun
g_warning ("setting post_iterate on a non MANAGER bin has no effect");
bin->post_iterate_func = func;
bin->post_iterate_private = func_data;
bin->post_iterate_data = user_data;
}
......@@ -31,9 +31,10 @@ G_BEGIN_DECLS
extern GstElementDetails gst_bin_details;
extern GType _gst_bin_type;
#define GST_TYPE_BIN (_gst_bin_type)
# define GST_IS_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_BIN))
# define GST_IS_BIN_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_BIN))
#define GST_TYPE_BIN (_gst_bin_type)
#define GST_IS_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_BIN))
#define GST_IS_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_BIN))
#define GST_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BIN, GstBinClass))
#define GST_BIN_CAST(obj) ((GstBin*)(obj))
#define GST_BIN_CLASS_CAST(klass) ((GstBinClass*)(klass))
......@@ -46,7 +47,7 @@ extern GType _gst_bin_type;
# define GST_BIN_CLASS GST_BIN_CLASS_CAST
#endif
typedef void (*GstBinPrePostIterateFunction) (GstBin *bin, gpointer data);
typedef void (*GstBinPrePostIterateFunction) (GstBin *bin, gpointer user_data);
typedef enum {
/* this bin is a manager of child elements, i.e. a pipeline or thread */
......@@ -76,12 +77,12 @@ struct _GstBin {
GstElementState child_states[GST_NUM_STATES];
gpointer sched_private;
GstBinPrePostIterateFunction pre_iterate_func;
GstBinPrePostIterateFunction post_iterate_func;
gpointer pre_iterate_private;
gpointer post_iterate_private;
gpointer pre_iterate_data;
gpointer post_iterate_data;
gpointer dummy[8];
};
struct _GstBinClass {
......@@ -90,13 +91,15 @@ struct _GstBinClass {
/* vtable */
void (*add_element) (GstBin *bin, GstElement);
void (*remove_element) (GstBin *bin, GstElement);
/* run a full iteration of operation */
gboolean (*iterate) (GstBin *bin);
/* signals */
void (*object_added) (GstObject *object, GstObject *child);
void (*object_removed) (GstObject *object, GstObject *child);
void (*element_added) (GstBin *bin, GstElement *child);
void (*element_removed) (GstBin *bin, GstElement *child);
gpointer dummy[8];
};
GType gst_bin_get_type (void);
......@@ -121,11 +124,15 @@ void gst_bin_auto_clock (GstBin *bin);
/* internal */
/* one of our childs signaled a state change */
void gst_bin_child_state_change (GstBin *bin, GstElementState oldstate,
GstElementState newstate, GstElement *child);
void gst_bin_set_pre_iterate_function (GstBin *bin, GstBinPrePostIterateFunction func, gpointer func_data);
void gst_bin_set_post_iterate_function (GstBin *bin, GstBinPrePostIterateFunction func, gpointer func_data);
void gst_bin_child_state_change (GstBin *bin, GstElementState oldstate,
GstElementState newstate, GstElement *child);
void gst_bin_set_pre_iterate_function (GstBin *bin,
GstBinPrePostIterateFunction func,
gpointer user_data);
void gst_bin_set_post_iterate_function (GstBin *bin,
GstBinPrePostIterateFunction func,
gpointer user_data);
G_END_DECLS
......
......@@ -219,7 +219,8 @@ gst_buffer_new_and_alloc (guint size)
* Returns: the new #GstBuffer, or NULL if there was an error.
*/
GstBuffer*
gst_buffer_new_from_pool (GstBufferPool *pool, guint64 offset, guint size)
gst_buffer_new_from_pool (GstBufferPool *pool,
gint64 offset, guint size)
{
GstBuffer *buffer;
......
......@@ -56,6 +56,7 @@ extern GType _gst_buffer_pool_type;
#define GST_BUFFER_SIZE(buf) (GST_BUFFER(buf)->size)
#define GST_BUFFER_MAXSIZE(buf) (GST_BUFFER(buf)->maxsize)
#define GST_BUFFER_TIMESTAMP(buf) (GST_BUFFER(buf)->timestamp)
#define GST_BUFFER_FORMAT(buf) (GST_BUFFER(buf)->format)
#define GST_BUFFER_OFFSET(buf) (GST_BUFFER(buf)->offset)
#define GST_BUFFER_BUFFERPOOL(buf) (GST_BUFFER(buf)->pool)
#define GST_BUFFER_POOL_PRIVATE(buf) (GST_BUFFER(buf)->pool_private)
......@@ -79,7 +80,9 @@ struct _GstBuffer {
guint size; /* size of buffer data */
guint64 maxsize; /* max size of this buffer */
/* timestamp */
guint64 timestamp;
/* media specific offset */
guint64 offset;
/* this is a pointer to the buffer pool (if any) */
......@@ -90,9 +93,14 @@ struct _GstBuffer {
/* bufferpools */
typedef GstBuffer* (*GstBufferPoolBufferNewFunction) (GstBufferPool *pool, guint64 offset, guint size, gpointer user_data);
typedef GstBuffer* (*GstBufferPoolBufferCopyFunction) (GstBufferPool *pool, const GstBuffer *buffer, gpointer user_data);
typedef void (*GstBufferPoolBufferFreeFunction) (GstBufferPool *pool, GstBuffer *buffer, gpointer user_data);
typedef GstBuffer* (*GstBufferPoolBufferNewFunction) (GstBufferPool *pool, gint64 offset,
guint size, gpointer user_data);
typedef GstBuffer* (*GstBufferPoolBufferCopyFunction) (GstBufferPool *pool,
const GstBuffer *buffer,
gpointer user_data);
typedef void (*GstBufferPoolBufferFreeFunction) (GstBufferPool *pool,
GstBuffer *buffer,
gpointer user_data);
struct _GstBufferPool {
GstData data;
......@@ -106,22 +114,13 @@ struct _GstBufferPool {
gpointer user_data;
};
/*< private >*/
void _gst_buffer_initialize (void);
/* functions used by subclasses and bufferpools */
void gst_buffer_default_free (GstBuffer *buffer);
GstBuffer* gst_buffer_default_copy (GstBuffer *buffer);
void gst_buffer_print_stats (void);
/* allocation */
GstBuffer* gst_buffer_new (void);
GstBuffer* gst_buffer_new_and_alloc (guint size);
/* creating a new buffer from a pool */
GstBuffer* gst_buffer_new_from_pool (GstBufferPool *pool, guint64 offset, guint size);
GstBuffer* gst_buffer_new_from_pool (GstBufferPool *pool,
gint64 offset, guint size);
#define gst_buffer_set_data(buf, data, size) \
G_STMT_START { \
......@@ -147,6 +146,15 @@ GstBuffer* gst_buffer_merge (GstBuffer *buf1, GstBuffer *buf2);
gboolean gst_buffer_is_span_fast (GstBuffer *buf1, GstBuffer *buf2);
GstBuffer* gst_buffer_span (GstBuffer *buf1, guint32 offset, GstBuffer *buf2, guint32 len);
/* --- private --- */
void _gst_buffer_initialize (void);
/* functions used by subclasses and bufferpools */
void gst_buffer_default_free (GstBuffer *buffer);
GstBuffer* gst_buffer_default_copy (GstBuffer *buffer);
void gst_buffer_print_stats (void);
/* creating a new buffer pools */
GstBufferPool* gst_buffer_pool_new (GstDataFreeFunction free,
......@@ -159,6 +167,7 @@ GstBufferPool* gst_buffer_pool_new (GstDataFreeFunction free,
/* function used by subclasses and bufferpools */
void gst_buffer_pool_default_free (GstBufferPool *pool);
/* check if pool is usable */
gboolean gst_buffer_pool_is_active (GstBufferPool *pool);
void gst_buffer_pool_set_active (GstBufferPool *pool, gboolean active);
......
......@@ -29,8 +29,7 @@
* gstbuffer.c */
static GstBuffer* _gst_buffer_pool_default_buffer_new (GstBufferPool *pool,
guint64 offset,
guint size,
gint64 offset, guint size,
gpointer user_data);
static void _gst_buffer_pool_default_buffer_free (GstBufferPool *pool,
GstBuffer *buffer,
......@@ -114,11 +113,11 @@ gst_buffer_pool_get_default (guint buffer_size, guint pool_size)
}
static GstBuffer*
_gst_buffer_pool_default_buffer_new (GstBufferPool *pool, guint64 offset /*unused*/,
guint size /*unused*/, gpointer user_data)
_gst_buffer_pool_default_buffer_new (GstBufferPool *pool, gint64 offset,
guint size, gpointer user_data)
{
GstBuffer *buffer;
GstBufferPoolDefault *def = (GstBufferPoolDefault*)user_data;
GstBufferPoolDefault *def = (GstBufferPoolDefault*) user_data;
GstMemChunk *data_chunk = def->mem_chunk;
buffer = gst_buffer_new ();
......
......@@ -34,8 +34,6 @@ enum {
ARG_STATS,
};
#define CLASS(clock) GST_CLOCK_CLASS (G_OBJECT_GET_CLASS (clock))
static GstMemChunk *_gst_clock_entries_chunk;
static void gst_clock_class_init (GstClockClass *klass);
......@@ -151,6 +149,7 @@ gst_clock_id_wait (GstClockID id, GstClockTimeDiff *jitter)
GstClock *clock;
GstClockReturn res = GST_CLOCK_UNSUPPORTED;
GstClockTime requested;
GstClockClass *cclass;
g_return_val_if_fail (id != NULL, GST_CLOCK_ERROR);
......@@ -163,12 +162,13 @@ gst_clock_id_wait (GstClockID id, GstClockTimeDiff *jitter)
}
clock = GST_CLOCK_ENTRY_CLOCK (entry);
cclass = GST_CLOCK_GET_CLASS (clock);
if (CLASS (clock)->wait) {
if (cclass->wait) {
GstClockTime now;
do {
res = CLASS (clock)->wait (clock, entry);
res = cclass->wait (clock, entry);
}
while (res == GST_CLOCK_ENTRY_RESTART);
......@@ -208,6 +208,7 @@ gst_clock_id_wait_async (GstClockID id,
GstClockEntry *entry;
GstClock *clock;
GstClockReturn res = GST_CLOCK_UNSUPPORTED;
GstClockClass *cclass;
g_return_val_if_fail (id != NULL, GST_CLOCK_ERROR);
g_return_val_if_fail (func != NULL, GST_CLOCK_ERROR);
......@@ -220,8 +221,13 @@ gst_clock_id_wait_async (GstClockID id,
return GST_CLOCK_TIMEOUT;
}
if (CLASS (clock)->wait_async) {
res = CLASS (clock)->wait_async (clock, entry, func, user_data);
cclass = GST_CLOCK_GET_CLASS (clock);
if (cclass->wait_async) {
entry->func = func;
entry->user_data = user_data;
res = cclass->wait_async (clock, entry);
}
return res;
......@@ -238,14 +244,17 @@ gst_clock_id_unschedule (GstClockID id)
{
GstClockEntry *entry;
GstClock *clock;
GstClockClass *cclass;
g_return_if_fail (id != NULL);
entry = (GstClockEntry *) id;
clock = entry->clock;
if (CLASS (clock)->unschedule)
CLASS (clock)->unschedule (clock, entry);
cclass = GST_CLOCK_GET_CLASS (clock);
if (cclass->unschedule)
cclass->unschedule (clock, entry);
}
/**
......@@ -273,14 +282,17 @@ gst_clock_id_unlock (GstClockID id)
{
GstClockEntry *entry;
GstClock *clock;
GstClockClass *cclass;
g_return_if_fail (id != NULL);
entry = (GstClockEntry *) id;
clock = entry->clock;
if (CLASS (clock)->unlock)
CLASS (clock)->unlock (clock, entry);
cclass = GST_CLOCK_GET_CLASS (clock);
if (cclass->unlock)
cclass->unlock (clock, entry);
}
......@@ -368,10 +380,14 @@ gst_clock_init (GstClock *clock)
gdouble
gst_clock_set_speed (GstClock *clock, gdouble speed)
{
GstClockClass *cclass;
g_return_val_if_fail (GST_IS_CLOCK (clock), 0.0);
if (CLASS (clock)->change_speed)
clock->speed = CLASS (clock)->change_speed (clock, clock->speed, speed);
cclass = GST_CLOCK_GET_CLASS (clock);
if (cclass->change_speed)
clock->speed = cclass->change_speed (clock, clock->speed, speed);
return clock->speed;
}
......@@ -404,11 +420,15 @@ gst_clock_get_speed (GstClock *clock)
guint64
gst_clock_set_resolution (GstClock *clock, guint64 resolution)
{
GstClockClass *cclass;
g_return_val_if_fail (GST_IS_CLOCK (clock), 0LL);
g_return_val_if_fail (resolution != 0, 0LL);
if (CLASS (clock)->change_resolution)
clock->resolution = CLASS (clock)->change_resolution (clock, clock->resolution, resolution);
cclass = GST_CLOCK_GET_CLASS (clock);
if (cclass->change_resolution)
clock->resolution = cclass->change_resolution (clock, clock->resolution, resolution);
return clock->resolution;
}
......@@ -424,10 +444,14 @@ gst_clock_set_resolution (GstClock *clock, guint64 resolution)
guint64
gst_clock_get_resolution (GstClock *clock)
{
GstClockClass *cclass;
g_return_val_if_fail (GST_IS_CLOCK (clock), 0LL);
if (CLASS (clock)->get_resolution)
return CLASS (clock)->get_resolution (clock);
cclass = GST_CLOCK_GET_CLASS (clock);
if (cclass->get_resolution)
return cclass->get_resolution (clock);
return 1LL;
}
......@@ -444,13 +468,16 @@ void
gst_clock_set_active (GstClock *clock, gboolean active)
{
GstClockTime time = 0LL;
GstClockClass *cclass;
g_return_if_fail (GST_IS_CLOCK (clock));
clock->active = active;
cclass = GST_CLOCK_GET_CLASS (clock);
if (CLASS (clock)->get_internal_time) {
time = CLASS (clock)->get_internal_time (clock);
if (cclass->get_internal_time) {
time = cclass->get_internal_time (clock);
}
GST_LOCK (clock);
......@@ -495,11 +522,14 @@ void
gst_clock_reset (GstClock *clock)
{
GstClockTime time = 0LL;
GstClockClass *cclass;
g_return_if_fail (GST_IS_CLOCK (clock));
if (CLASS (clock)->get_internal_time) {
time = CLASS (clock)->get_internal_time (clock);
cclass = GST_CLOCK_GET_CLASS (clock);
if (cclass->get_internal_time) {
time = cclass->get_internal_time (clock);
}
GST_LOCK (clock);
......@@ -534,8 +564,12 @@ gst_clock_handle_discont (GstClock *clock, guint64 time)
GST_LOCK (clock);
if (clock->accept_discont) {
if (CLASS (clock)->get_internal_time) {
itime = CLASS (clock)->get_internal_time (clock);
GstClockClass *cclass;
cclass = GST_CLOCK_GET_CLASS (clock);
if (cclass->get_internal_time) {
itime = cclass->get_internal_time (clock);
}
}
else {
......@@ -582,8 +616,12 @@ gst_clock_get_time (GstClock *clock)
ret = clock->last_time;
}
else {
if (CLASS (clock)->get_internal_time) {
ret = CLASS (clock)->get_internal_time (clock) - clock->start_time;
GstClockClass *cclass;
cclass = GST_CLOCK_GET_CLASS (clock);
if (cclass->get_internal_time) {
ret = cclass->get_internal_time (clock) - clock->start_time;
}
/* make sure the time is increasing, else return last_time */
if ((gint64) ret < (gint64) clock->last_time) {
......
......@@ -27,16 +27,13 @@
G_BEGIN_DECLS
#define GST_TYPE_CLOCK \
(gst_clock_get_type())
#define GST_CLOCK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CLOCK,GstClock))
#define GST_CLOCK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CLOCK,GstClockClass))
#define GST_IS_CLOCK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CLOCK))
#define GST_IS_CLOCK_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CLOCK))
/* --- standard type macros --- */
#define GST_TYPE_CLOCK (gst_clock_get_type ())
#define GST_CLOCK(clock) (G_TYPE_CHECK_INSTANCE_CAST ((clock), GST_TYPE_CLOCK, GstClock))
#define GST_IS_CLOCK(clock) (G_TYPE_CHECK_INSTANCE_TYPE ((clock), GST_TYPE_CLOCK))
#define GST_CLOCK_CLASS(cclass) (G_TYPE_CHECK_CLASS_CAST ((cclass), GST_TYPE_CLOCK, GstClockClass))
#define GST_IS_CLOCK_CLASS(cclass) (G_TYPE_CHECK_CLASS_TYPE ((cclass), GST_TYPE_CLOCK))
#define GST_CLOCK_GET_CLASS(clock) (G_TYPE_INSTANCE_GET_CLASS ((clock), GST_TYPE_CLOCK, GstClockClass))
typedef guint64 GstClockTime;
typedef gint64 GstClockTimeDiff;
......@@ -61,6 +58,7 @@ typedef struct _GstClockEntry GstClockEntry;
typedef struct _GstClock GstClock;
typedef struct _GstClockClass GstClockClass;
/* --- prototype for async callbacks --- */
typedef gboolean (*GstClockCallback) (GstClock *clock, GstClockTime time,
GstClockID id, gpointer user_data);
......@@ -121,11 +119,11 @@ struct _GstClock {
GstClockFlags flags;
/*< protected >*/
/* --- protected --- */
GstClockTime start_time;
GstClockTime last_time;
/*< private >*/
/* --- private --- */
gboolean accept_discont;
gdouble speed;
guint64 resolution;
......@@ -134,6 +132,8 @@ struct _GstClock {
GMutex *active_mutex;
GCond *active_cond;
gboolean stats;
gpointer dummy[4];
};
struct _GstClockClass {
......@@ -151,14 +151,9 @@ struct _GstClockClass {
/* waiting on an ID */
GstClockEntryStatus (*wait) (GstClock *clock, GstClockEntry *entry);
GstClockEntryStatus (*wait_async) (GstClock *clock, GstClockEntry *entry,
GstClockCallback func, gpointer user_data);
GstClockEntryStatus (*wait_async) (GstClock *clock, GstClockEntry *entry);
void (*unschedule) (GstClock *clock, GstClockEntry *entry);
void (*unlock) (GstClock *clock, GstClockEntry *entry);
/* signals */
void (*object_sync) (GstClock *clock, GstObject *object,
GstClockID id);
};
GType gst_clock_get_type (void);
......
......@@ -49,8 +49,6 @@ enum {
/* FILL ME */
};
#define CLASS(element) GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element))
static void gst_element_class_init (GstElementClass *klass);
static void gst_element_init (GstElement *element);
static void gst_element_base_class_init (GstElementClass *klass);
......@@ -186,7 +184,7 @@ gst_element_init (GstElement *element)
static void
gst_element_real_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
GstElementClass *oclass = CLASS (object);
GstElementClass *oclass = GST_ELEMENT_GET_CLASS (object);
if (oclass->set_property)
(oclass->set_property) (object, prop_id, value, pspec);
......@@ -195,7 +193,7 @@ gst_element_real_set_property (GObject *object, guint prop_id, const GValue *val
static void
gst_element_real_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
GstElementClass *oclass = CLASS (object);
GstElementClass *oclass = GST_ELEMENT_GET_CLASS (object);