summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOle André Vadla Ravnås <oravnas@cisco.com>2009-09-07 16:09:34 +0200
committerOle André Vadla Ravnås <oravnas@cisco.com>2010-10-28 17:08:35 +0200
commitf2b4d8990da2443df049987dcfb610a38a83693e (patch)
tree3bd822b83901f2c3190af4237fd41fe3afe7a94c
parent00bc7860ffdcf522d4f20485e8d11156db233f03 (diff)
winks: store priv pointer instead of looking it up
-rw-r--r--sys/winks/gstksclock.c15
-rw-r--r--sys/winks/gstksclock.h7
-rw-r--r--sys/winks/gstksvideodevice.c12
-rw-r--r--sys/winks/gstksvideodevice.h7
-rw-r--r--sys/winks/gstksvideosrc.c14
-rw-r--r--sys/winks/gstksvideosrc.h7
6 files changed, 39 insertions, 23 deletions
diff --git a/sys/winks/gstksclock.c b/sys/winks/gstksclock.c
index 6ed642ec0..db1a8a16b 100644
--- a/sys/winks/gstksclock.c
+++ b/sys/winks/gstksclock.c
@@ -24,7 +24,7 @@
GST_DEBUG_CATEGORY_EXTERN (gst_ks_debug);
#define GST_CAT_DEFAULT gst_ks_debug
-typedef struct
+struct _GstKsClockPrivate
{
GMutex *mutex;
GCond *client_cond;
@@ -41,11 +41,9 @@ typedef struct
gboolean worker_initialized;
GstClock *master_clock;
-} GstKsClockPrivate;
+};
-#define GST_KS_CLOCK_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_KS_CLOCK, \
- GstKsClockPrivate))
+#define GST_KS_CLOCK_GET_PRIVATE(o) ((o)->priv)
#define GST_KS_CLOCK_LOCK() g_mutex_lock (priv->mutex)
#define GST_KS_CLOCK_UNLOCK() g_mutex_unlock (priv->mutex)
@@ -74,7 +72,12 @@ gst_ks_clock_class_init (GstKsClockClass * klass)
static void
gst_ks_clock_init (GstKsClock * self, GstKsClockClass * gclass)
{
- GstKsClockPrivate *priv = GST_KS_CLOCK_GET_PRIVATE (self);
+ GstKsClockPrivate *priv;
+
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GST_TYPE_KS_CLOCK,
+ GstKsClockPrivate);
+
+ priv = GST_KS_CLOCK_GET_PRIVATE (self);
priv->mutex = g_mutex_new ();
priv->client_cond = g_cond_new ();
diff --git a/sys/winks/gstksclock.h b/sys/winks/gstksclock.h
index 42a043f1e..809b76bd9 100644
--- a/sys/winks/gstksclock.h
+++ b/sys/winks/gstksclock.h
@@ -38,12 +38,15 @@ G_BEGIN_DECLS
#define GST_IS_KS_CLOCK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_KS_CLOCK))
-typedef struct _GstKsClock GstKsClock;
-typedef struct _GstKsClockClass GstKsClockClass;
+typedef struct _GstKsClock GstKsClock;
+typedef struct _GstKsClockClass GstKsClockClass;
+typedef struct _GstKsClockPrivate GstKsClockPrivate;
struct _GstKsClock
{
GObject parent;
+
+ GstKsClockPrivate *priv;
};
struct _GstKsClockClass
diff --git a/sys/winks/gstksvideodevice.c b/sys/winks/gstksvideodevice.c
index 2f075427e..3e59d2a35 100644
--- a/sys/winks/gstksvideodevice.c
+++ b/sys/winks/gstksvideodevice.c
@@ -57,7 +57,7 @@ typedef struct
OVERLAPPED overlapped;
} ReadRequest;
-typedef struct
+struct _GstKsVideoDevicePrivate
{
gboolean open;
KSSTATE state;
@@ -87,9 +87,7 @@ typedef struct
GstClockTime last_timestamp;
} GstKsVideoDevicePrivate;
-#define GST_KS_VIDEO_DEVICE_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_KS_VIDEO_DEVICE, \
- GstKsVideoDevicePrivate))
+#define GST_KS_VIDEO_DEVICE_GET_PRIVATE(o) ((o)->priv)
static void gst_ks_video_device_dispose (GObject * object);
static void gst_ks_video_device_get_property (GObject * object, guint prop_id,
@@ -132,8 +130,12 @@ static void
gst_ks_video_device_init (GstKsVideoDevice * self,
GstKsVideoDeviceClass * gclass)
{
- GstKsVideoDevicePrivate *priv = GST_KS_VIDEO_DEVICE_GET_PRIVATE (self);
+ GstKsVideoDevicePrivate *priv;
+
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GST_TYPE_KS_VIDEO_DEVICE,
+ GstKsVideoDevicePrivate);
+ priv = GST_KS_VIDEO_DEVICE_GET_PRIVATE (self);
priv->open = FALSE;
priv->state = KSSTATE_STOP;
}
diff --git a/sys/winks/gstksvideodevice.h b/sys/winks/gstksvideodevice.h
index 99024e159..e5d80da99 100644
--- a/sys/winks/gstksvideodevice.h
+++ b/sys/winks/gstksvideodevice.h
@@ -38,12 +38,15 @@ G_BEGIN_DECLS
#define GST_IS_KS_VIDEO_DEVICE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_KS_VIDEO_DEVICE))
-typedef struct _GstKsVideoDevice GstKsVideoDevice;
-typedef struct _GstKsVideoDeviceClass GstKsVideoDeviceClass;
+typedef struct _GstKsVideoDevice GstKsVideoDevice;
+typedef struct _GstKsVideoDeviceClass GstKsVideoDeviceClass;
+typedef struct _GstKsVideoDevicePrivate GstKsVideoDevicePrivate;
struct _GstKsVideoDevice
{
GObject parent;
+
+ GstKsVideoDevicePrivate *priv;
};
struct _GstKsVideoDeviceClass
diff --git a/sys/winks/gstksvideosrc.c b/sys/winks/gstksvideosrc.c
index 1e3370be9..de6d56184 100644
--- a/sys/winks/gstksvideosrc.c
+++ b/sys/winks/gstksvideosrc.c
@@ -84,7 +84,7 @@ typedef enum
KS_WORKER_STATE_ERROR,
} KsWorkerState;
-typedef struct
+struct _GstKsVideoSrcPrivate
{
/* Properties */
gchar *device_path;
@@ -118,11 +118,9 @@ typedef struct
GstClockTime last_sampling;
guint count;
guint fps;
-} GstKsVideoSrcPrivate;
+};
-#define GST_KS_VIDEO_SRC_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_KS_VIDEO_SRC, \
- GstKsVideoSrcPrivate))
+#define GST_KS_VIDEO_SRC_GET_PRIVATE(o) ((o)->priv)
static void gst_ks_video_src_init_interfaces (GType type);
@@ -238,8 +236,12 @@ gst_ks_video_src_class_init (GstKsVideoSrcClass * klass)
static void
gst_ks_video_src_init (GstKsVideoSrc * self, GstKsVideoSrcClass * gclass)
{
- GstKsVideoSrcPrivate *priv = GST_KS_VIDEO_SRC_GET_PRIVATE (self);
GstBaseSrc *basesrc = GST_BASE_SRC (self);
+ GstKsVideoSrcPrivate *priv;
+
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GST_TYPE_KS_VIDEO_SRC,
+ GstKsVideoSrcPrivate);
+ priv = GST_KS_VIDEO_SRC_GET_PRIVATE (self);
gst_base_src_set_live (basesrc, TRUE);
gst_base_src_set_format (basesrc, GST_FORMAT_TIME);
diff --git a/sys/winks/gstksvideosrc.h b/sys/winks/gstksvideosrc.h
index d41023da6..d7766c27f 100644
--- a/sys/winks/gstksvideosrc.h
+++ b/sys/winks/gstksvideosrc.h
@@ -36,12 +36,15 @@ G_BEGIN_DECLS
#define GST_IS_KS_VIDEO_SRC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_KS_VIDEO_SRC))
-typedef struct _GstKsVideoSrc GstKsVideoSrc;
-typedef struct _GstKsVideoSrcClass GstKsVideoSrcClass;
+typedef struct _GstKsVideoSrc GstKsVideoSrc;
+typedef struct _GstKsVideoSrcClass GstKsVideoSrcClass;
+typedef struct _GstKsVideoSrcPrivate GstKsVideoSrcPrivate;
struct _GstKsVideoSrc
{
GstPushSrc push_src;
+
+ GstKsVideoSrcPrivate * priv;
};
struct _GstKsVideoSrcClass