mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
winks: store priv pointer instead of looking it up
This commit is contained in:
parent
00bc7860ff
commit
f2b4d8990d
6 changed files with 39 additions and 23 deletions
|
@ -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 ();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue