Commit ae87d97c authored by Wim Taymans's avatar Wim Taymans
Browse files

- Removed unused locking from the cothreads

Original commit message from CVS:
- Removed unused locking from the cothreads
- use G_*_DECLS in .h files
- remove gstlog.h include from gstobject.h, add to .c files
- removed unused refcounting code from gstobject
- small fixes in #includes
- Added Scheduling policy and priority properties to gstthread so that
SCHED_FIFO and SCHED_RR threads can be constructed.
parent 160f5b16
......@@ -20,7 +20,6 @@
*/
#include <gst/gst.h>
#include "../cothreads.h"
GstElementDetails gst_autoplugcache_details = {
"AutoplugCache",
......
......@@ -58,9 +58,7 @@
#include <gst/gstextratypes.h>
#include <gst/gstenumtypes.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
G_BEGIN_DECLS
/* initialize GST */
void gst_init (int *argc, char **argv[]);
......@@ -74,9 +72,7 @@ gboolean gst_has_threads (void);
void gst_main (void);
void gst_main_quit (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#include <gst/gstlog.h>
......
......@@ -28,6 +28,7 @@
#include "gstautoplug.h"
#include "gstregistry.h"
#include "gstlog.h"
enum {
NEW_OBJECT,
......
......@@ -28,9 +28,7 @@
#include <gst/gstelement.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
G_BEGIN_DECLS
#define GST_TYPE_AUTOPLUG \
(gst_autoplug_get_type())
......@@ -118,9 +116,7 @@ GstAutoplugFactory* gst_autoplug_factory_find (const gchar *name);
GstAutoplug* gst_autoplug_factory_create (GstAutoplugFactory *factory);
GstAutoplug* gst_autoplug_factory_make (const gchar *name);
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#else /* GST_DISABLE_AUTOPLUG */
......
......@@ -27,6 +27,7 @@
#include "gstevent.h"
#include "gstbin.h"
#include "gstxml.h"
#include "gstlog.h"
#include "gstscheduler.h"
......
......@@ -26,9 +26,7 @@
#include <gst/gstelement.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
G_BEGIN_DECLS
extern GstElementDetails gst_bin_details;
extern GType _gst_bin_type;
......@@ -133,9 +131,8 @@ void gst_bin_child_state_change (GstBin *bin, GstElementState oldstate,
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);
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#endif /* __GST_BIN_H__ */
......
......@@ -25,6 +25,7 @@
#include "gstcaps.h"
#include "gsttype.h"
#include "gstlog.h"
static GMemChunk *_gst_caps_chunk;
static GMutex *_gst_caps_chunk_lock;
......
......@@ -24,13 +24,9 @@
#ifndef __GST_CAPS_H__
#define __GST_CAPS_H__
#include <gst/gstconfig.h>
#include <gst/gstprops.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
G_BEGIN_DECLS
typedef struct _GstCaps GstCaps;
......@@ -140,8 +136,6 @@ xmlNodePtr gst_caps_save_thyself (GstCaps *caps, xmlNodePtr parent);
GstCaps* gst_caps_load_thyself (xmlNodePtr parent);
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#endif /* __GST_CAPS_H__ */
......@@ -24,12 +24,10 @@
#ifndef __GST_CLOCK_H__
#define __GST_CLOCK_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <gst/gstobject.h>
G_BEGIN_DECLS
#define GST_TYPE_CLOCK \
(gst_clock_get_type())
#define GST_CLOCK(obj) \
......@@ -130,8 +128,6 @@ GstClockTime gst_clock_id_get_time (GstClockID id);
void gst_clock_set_resolution (GstClock *clock, guint64 resolution);
guint64 gst_clock_get_resolution (GstClock *clock);
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#endif /* __GST_CLOCK_H__ */
......@@ -25,7 +25,6 @@
#define __GST_ELEMENT_H__
#include <gst/gstconfig.h>
#include <gst/gsttypes.h>
#include <gst/gstobject.h>
#include <gst/gstpad.h>
......
......@@ -25,6 +25,7 @@
#include "gstelement.h"
#include "gstregistry.h"
#include "gstlog.h"
static void gst_element_factory_class_init (GstElementFactoryClass *klass);
static void gst_element_factory_init (GstElementFactory *factory);
......
......@@ -24,18 +24,13 @@
#ifndef __GST_EXTRA_TYPES_H__
#define __GST_EXTRA_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
G_BEGIN_DECLS
#define GST_TYPE_FILENAME (gst_extra_get_filename_type())
GType gst_extra_get_filename_type(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#endif /* __GST_EXTRA_TYPES_H__ */
......@@ -23,6 +23,7 @@
#include "gst_private.h"
#include "gstobject.h"
#include "gstlog.h"
/* Object signals and args */
enum {
......@@ -165,7 +166,6 @@ gst_object_ref (GstObject *object)
g_object_ref (G_OBJECT (object));
return object;
}
#define gst_object_ref gst_object_ref
/**
* gst_object_unref:
......@@ -184,7 +184,6 @@ gst_object_unref (GstObject *object)
g_object_unref (G_OBJECT (object));
}
#define gst_object_unref gst_object_unref
/**
* gst_object_sink:
......@@ -395,87 +394,6 @@ gst_object_unparent (GstObject *object)
gst_object_unref (object);
}
/**
* gst_object_ref:
* @object: GstObject to reference
*
* Increments the refence count on the object.
*
* Returns: Apointer to the Object
*/
#ifndef gst_object_ref
GstObject*
gst_object_ref (GstObject *object)
{
g_return_if_fail (object != NULL, NULL);
g_return_if_fail (GST_IS_OBJECT (object), NULL);
/* #ifdef HAVE_ATOMIC_H */
/* g_return_if_fail (atomic_read (&(object->refcount)) > 0); */
/* atomic_inc (&(object->refcount)) */
/* #else */
g_return_if_fail (object->refcount > 0);
GST_LOCK (object);
/* object->refcount++; */
g_object_ref((GObject *)object);
GST_UNLOCK (object);
/* #endif */
return object;
}
#endif /* gst_object_ref */
/**
* gst_object_unref:
* @object: GstObject to unreference
*
* Decrements the refence count on the object. If reference count hits
* zero, destroy the object.
*/
#ifndef gst_object_unref
void
gst_object_unref (GstObject *object)
{
int reftest;
g_return_if_fail (object != NULL);
g_return_if_fail (GST_IS_OBJECT (object));
#ifdef HAVE_ATOMIC_H
g_return_if_fail (atomic_read (&(object->refcount)) > 0);
reftest = atomic_dec_and_test (&(object->refcount))
#else
g_return_if_fail (object->refcount > 0);
GST_LOCK (object);
object->refcount--;
reftest = (object->refcount == 0);
GST_UNLOCK (object);
#endif
/* if we ended up with the refcount at zero */
if (reftest) {
/* get the count to 1 for gtk_object_destroy() */
#ifdef HAVE_ATOMIC_H
atomic_set (&(object->refcount),1);
#else
object->refcount = 1;
#endif
/* destroy it */
gtk_object_destroy (G_OBJECT (object));
/* drop the refcount back to zero */
#ifdef HAVE_ATOMIC_H
atomic_set (&(object->refcount),0);
#else
object->refcount = 0;
#endif
/* finalize the object */
/* FIXME this is an evil hack that should be killed */
/* FIXMEFIXMEFIXMEFIXME */
/* gtk_object_finalize(G_OBJECT(object)); */
}
}
#endif /* gst_object_unref */
/**
* gst_object_check_uniqueness:
* @list: a list of #GstObject to check through
......
......@@ -36,12 +36,7 @@
#include <gst/gsttrace.h>
#include <gst/gsttypes.h>
/* FIXME */
#include "gstlog.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
G_BEGIN_DECLS
extern GType _gst_object_type;
......@@ -75,14 +70,8 @@ struct _GstObject {
GObject object;
gchar *name;
/* have to have a refcount for the object */
#ifdef HAVE_ATOMIC_H
atomic_t refcount;
#else
gint refcount;
#endif
/* locking for all sorts of things (like the refcount) */
/* locking for all sorts of things */
GMutex *lock;
/* this object's parent */
GstObject *parent;
......@@ -176,10 +165,7 @@ void gst_class_signal_emit_by_name (GstObject *object,
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#endif /* __GST_OBJECT_H__ */
......@@ -25,6 +25,7 @@
#include "gstparse.h"
#include "gstinfo.h"
#include "gstlog.h"
#include "parse/types.h"
typedef struct _gst_parse_delayed_pad gst_parse_delayed_pad;
......
......@@ -23,7 +23,7 @@
#ifndef __GST_PARSE_H__
#define __GST_PARSE_H__
#include <gst/gstpipeline.h>
#include <gst/gstbin.h>
G_BEGIN_DECLS
......
......@@ -23,6 +23,7 @@
#include "gst_private.h"
#include "gstpipeline.h"
#include "gstlog.h"
#include "gstscheduler.h"
GstElementDetails gst_pipeline_details = {
......
......@@ -26,9 +26,7 @@
#include <gst/gstbin.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
G_BEGIN_DECLS
extern GstElementDetails gst_pipeline_details;
......@@ -59,10 +57,7 @@ GstElement* gst_pipeline_new (const gchar *name);
#define gst_pipeline_destroy(pipeline) gst_object_destroy(GST_OBJECT(pipeline))
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#endif /* __GST_PIPELINE_H__ */
......@@ -29,6 +29,7 @@
#include "gstplugin.h"
#include "gstversion.h"
#include "gstregistry.h"
#include "gstlog.h"
#include "config.h"
static GModule *main_module;
......
......@@ -27,9 +27,10 @@
#include <gst/gstconfig.h>
#include <gmodule.h>
#include <gst/gstpluginfeature.h>
G_BEGIN_DECLS
GQuark gst_plugin_error_quark (void);
#define GST_PLUGIN_ERROR gst_plugin_error_quark ()
......@@ -119,5 +120,6 @@ void gst_plugin_add_feature (GstPlugin *plugin, GstPluginFeature *feature);
gboolean gst_plugin_load (const gchar *name);
gboolean gst_library_load (const gchar *name);
G_END_DECLS
#endif /* __GST_PLUGIN_H__ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment