v4l2: Use G_DEFINE_ macros for added thread safety
This commit is contained in:
parent
e47ffb203b
commit
24286f1612
@ -31,47 +31,15 @@
|
|||||||
#include "gstv4l2object.h"
|
#include "gstv4l2object.h"
|
||||||
#include "v4l2_calls.h"
|
#include "v4l2_calls.h"
|
||||||
|
|
||||||
static void gst_v4l2_tuner_channel_class_init (GstV4l2TunerChannelClass *
|
G_DEFINE_TYPE (GstV4l2TunerChannel, gst_v4l2_tuner_channel,
|
||||||
klass);
|
GST_TYPE_TUNER_CHANNEL);
|
||||||
static void gst_v4l2_tuner_channel_init (GstV4l2TunerChannel * channel);
|
|
||||||
|
|
||||||
static void gst_v4l2_tuner_norm_class_init (GstV4l2TunerNormClass * klass);
|
G_DEFINE_TYPE (GstV4l2TunerNorm, gst_v4l2_tuner_norm, GST_TYPE_TUNER_NORM);
|
||||||
static void gst_v4l2_tuner_norm_init (GstV4l2TunerNorm * norm);
|
|
||||||
|
|
||||||
static GstTunerNormClass *norm_parent_class = NULL;
|
|
||||||
static GstTunerChannelClass *channel_parent_class = NULL;
|
|
||||||
|
|
||||||
GType
|
|
||||||
gst_v4l2_tuner_channel_get_type (void)
|
|
||||||
{
|
|
||||||
static GType gst_v4l2_tuner_channel_type = 0;
|
|
||||||
|
|
||||||
if (!gst_v4l2_tuner_channel_type) {
|
|
||||||
static const GTypeInfo v4l2_tuner_channel_info = {
|
|
||||||
sizeof (GstV4l2TunerChannelClass),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
(GClassInitFunc) gst_v4l2_tuner_channel_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
sizeof (GstV4l2TunerChannel),
|
|
||||||
0,
|
|
||||||
(GInstanceInitFunc) gst_v4l2_tuner_channel_init,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
gst_v4l2_tuner_channel_type =
|
|
||||||
g_type_register_static (GST_TYPE_TUNER_CHANNEL,
|
|
||||||
"GstV4l2TunerChannel", &v4l2_tuner_channel_info, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return gst_v4l2_tuner_channel_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_v4l2_tuner_channel_class_init (GstV4l2TunerChannelClass * klass)
|
gst_v4l2_tuner_channel_class_init (GstV4l2TunerChannelClass * klass)
|
||||||
{
|
{
|
||||||
channel_parent_class = g_type_class_peek_parent (klass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -82,37 +50,9 @@ gst_v4l2_tuner_channel_init (GstV4l2TunerChannel * channel)
|
|||||||
channel->audio = (guint32) - 1;
|
channel->audio = (guint32) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
GType
|
|
||||||
gst_v4l2_tuner_norm_get_type (void)
|
|
||||||
{
|
|
||||||
static GType gst_v4l2_tuner_norm_type = 0;
|
|
||||||
|
|
||||||
if (!gst_v4l2_tuner_norm_type) {
|
|
||||||
static const GTypeInfo v4l2_tuner_norm_info = {
|
|
||||||
sizeof (GstV4l2TunerNormClass),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
(GClassInitFunc) gst_v4l2_tuner_norm_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
sizeof (GstV4l2TunerNorm),
|
|
||||||
0,
|
|
||||||
(GInstanceInitFunc) gst_v4l2_tuner_norm_init,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
gst_v4l2_tuner_norm_type =
|
|
||||||
g_type_register_static (GST_TYPE_TUNER_NORM,
|
|
||||||
"GstV4l2TunerNorm", &v4l2_tuner_norm_info, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return gst_v4l2_tuner_norm_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_v4l2_tuner_norm_class_init (GstV4l2TunerNormClass * klass)
|
gst_v4l2_tuner_norm_class_init (GstV4l2TunerNormClass * klass)
|
||||||
{
|
{
|
||||||
norm_parent_class = g_type_class_peek_parent (klass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -82,37 +82,12 @@ enum
|
|||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gst_tuner_class_init (GstTunerInterface * iface);
|
|
||||||
|
|
||||||
static guint gst_tuner_signals[LAST_SIGNAL] = { 0 };
|
static guint gst_tuner_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
GType
|
G_DEFINE_INTERFACE (GstTuner, gst_tuner, G_TYPE_INVALID);
|
||||||
gst_tuner_get_type (void)
|
|
||||||
{
|
|
||||||
static GType gst_tuner_type = 0;
|
|
||||||
|
|
||||||
if (!gst_tuner_type) {
|
|
||||||
static const GTypeInfo gst_tuner_info = {
|
|
||||||
sizeof (GstTunerInterface),
|
|
||||||
(GBaseInitFunc) gst_tuner_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
gst_tuner_type = g_type_register_static (G_TYPE_INTERFACE,
|
|
||||||
"GstTuner", &gst_tuner_info, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return gst_tuner_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_tuner_class_init (GstTunerInterface * iface)
|
gst_tuner_default_init (GstTunerInterface * iface)
|
||||||
{
|
{
|
||||||
static gboolean initialized = FALSE;
|
static gboolean initialized = FALSE;
|
||||||
|
|
||||||
|
@ -51,47 +51,17 @@ enum
|
|||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gst_tuner_channel_class_init (GstTunerChannelClass * klass);
|
G_DEFINE_TYPE (GstTunerChannel, gst_tuner_channel, G_TYPE_OBJECT);
|
||||||
static void gst_tuner_channel_init (GstTunerChannel * channel);
|
|
||||||
static void gst_tuner_channel_dispose (GObject * object);
|
static void gst_tuner_channel_dispose (GObject * object);
|
||||||
|
|
||||||
static GObjectClass *parent_class = NULL;
|
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
static guint signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
GType
|
|
||||||
gst_tuner_channel_get_type (void)
|
|
||||||
{
|
|
||||||
static GType gst_tuner_channel_type = 0;
|
|
||||||
|
|
||||||
if (!gst_tuner_channel_type) {
|
|
||||||
static const GTypeInfo tuner_channel_info = {
|
|
||||||
sizeof (GstTunerChannelClass),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
(GClassInitFunc) gst_tuner_channel_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
sizeof (GstTunerChannel),
|
|
||||||
0,
|
|
||||||
(GInstanceInitFunc) gst_tuner_channel_init,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
gst_tuner_channel_type =
|
|
||||||
g_type_register_static (G_TYPE_OBJECT,
|
|
||||||
"GstTunerChannel", &tuner_channel_info, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return gst_tuner_channel_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_tuner_channel_class_init (GstTunerChannelClass * klass)
|
gst_tuner_channel_class_init (GstTunerChannelClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_klass = (GObjectClass *) klass;
|
GObjectClass *object_klass = (GObjectClass *) klass;
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstTunerChannel::frequency-changed:
|
* GstTunerChannel::frequency-changed:
|
||||||
* @tunerchannel: The #GstTunerChannel
|
* @tunerchannel: The #GstTunerChannel
|
||||||
@ -143,6 +113,5 @@ gst_tuner_channel_dispose (GObject * object)
|
|||||||
channel->label = NULL;
|
channel->label = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent_class->dispose)
|
G_OBJECT_CLASS (gst_tuner_channel_parent_class)->dispose (object);
|
||||||
parent_class->dispose (object);
|
|
||||||
}
|
}
|
||||||
|
@ -44,47 +44,18 @@ enum
|
|||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gst_tuner_norm_class_init (GstTunerNormClass * klass);
|
G_DEFINE_TYPE (GstTunerNorm, gst_tuner_norm, G_TYPE_OBJECT);
|
||||||
static void gst_tuner_norm_init (GstTunerNorm * norm);
|
|
||||||
static void gst_tuner_norm_dispose (GObject * object);
|
static void gst_tuner_norm_dispose (GObject * object);
|
||||||
|
|
||||||
static GObjectClass *parent_class = NULL;
|
|
||||||
|
|
||||||
/*static guint signals[LAST_SIGNAL] = { 0 };*/
|
/*static guint signals[LAST_SIGNAL] = { 0 };*/
|
||||||
|
|
||||||
GType
|
|
||||||
gst_tuner_norm_get_type (void)
|
|
||||||
{
|
|
||||||
static GType gst_tuner_norm_type = 0;
|
|
||||||
|
|
||||||
if (!gst_tuner_norm_type) {
|
|
||||||
static const GTypeInfo tuner_norm_info = {
|
|
||||||
sizeof (GstTunerNormClass),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
(GClassInitFunc) gst_tuner_norm_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
sizeof (GstTunerNorm),
|
|
||||||
0,
|
|
||||||
(GInstanceInitFunc) gst_tuner_norm_init,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
gst_tuner_norm_type =
|
|
||||||
g_type_register_static (G_TYPE_OBJECT,
|
|
||||||
"GstTunerNorm", &tuner_norm_info, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return gst_tuner_norm_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_tuner_norm_class_init (GstTunerNormClass * klass)
|
gst_tuner_norm_class_init (GstTunerNormClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_klass = (GObjectClass *) klass;
|
GObjectClass *object_klass = (GObjectClass *) klass;
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
|
||||||
|
|
||||||
object_klass->dispose = gst_tuner_norm_dispose;
|
object_klass->dispose = gst_tuner_norm_dispose;
|
||||||
}
|
}
|
||||||
@ -106,6 +77,5 @@ gst_tuner_norm_dispose (GObject * object)
|
|||||||
norm->label = NULL;
|
norm->label = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent_class->dispose)
|
G_OBJECT_CLASS (gst_tuner_norm_parent_class)->dispose (object);
|
||||||
parent_class->dispose (object);
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user